Golang-在Windows上更改构建工作路径

I'm testing simple Go program on Windows 8 with SublimeText3 (GoSublime plugin)

go run -v example.go

and before run it's being compiled inside ..AppData\Local\Temp.. directory. My antivirus program thinks that it's a virus and blocks it:

fork/exec C:\Users\D24F7~1.KAP\AppData\Local\Temp\go-build333212398\command-line-arguments_obj\exe\example.exe: Access is denied.

I can't disable it and my solution is to change the folder where it's being compiled. How can I do that?

You can build a binary directly using go build (out binary is at current dir) or go build -o /your/custom/path. Then just run the output binary.

I change ouput directoty

go build -i -o D:\Users\MyProj\out\

-o flag

and put to antivirus ignoring D:\Users\MyProj\out\ directory