Search code examples
gogoland

How can I change the default output folder path of the GO file?


Because I had installed the Avira in my computer, once I run my go file in GoLand, Avira will prompt me a security alert that "BLOCK HEUR/APC(could) ........."

Meanwhile, GoLand also shows that

Error running 'go build test.go': Cannot run program "C:\Users\Simon\AppData\Local\Temp___2go_build_test_go.exe" (in directory "E:\Application software\GO\awesomeProject"): CreateProcess error=5, ACCESS DENIED.

I want to know how can I change the default output path (i.e., build -o "path") to another path; after all, I don't want to close the realtime protection of Avira in each time, and ‘C’ disk is also a sensitive area. Should I configure the settings of the GO source or just change some settings in GoLand? B.T.W, unless necessary, I don't want to change the settings of Avira :)

Thanks in advance, I am a beginner of Go language.


Solution

  • You can edit the run configuration via Run | Edit Configurations... and set the Output directory to whatever location you'd like to, see the screenshot below.

    outpud directory in a run configuration

    If you wish to set this for all new run configurations of the project, then go to Run | Edit Configurations... | Templates | Go Build and then configure the Output directory setting there. All new Go Build configurations will then use that setting.