Where does go compiler store the executable file after executing following command?
$> go run file.go
In the /tmp
folder, if you're using unix machine.
In the \Users\SomeUser\AppData\Local\Temp\
if you're on windows.
In Go 1.8 or later, use os.Executable to see where your executable is located:
exePath, err := os.Executable()
if err != nil {
fmt.Println("Failed to get executable path:", err)
} else {
fmt.Println("Executable:", exePath)
}
go run myprog.go
Executable: /tmp/go-build260998498/command-line-arguments/_obj/exe/myprog