Avira blocking main.exe problem

Hi relatively new to GO but a great enthousiast. I recently upgraded to v1.25 and using vscode for development. My big problem at the moment is that my windows Avira security software blocks everything when I do a “go run main.go” in vscode. I cant figure out how to configure in this security package on how to leave this specific situation alone. Problem is that go run builds something in a temporary generated directory and Avira quarantines it immediately. I am sure that this the problem because once I switch off realtime checking setting in Avira for 10 mins or so , everything works fine. I am sure I am not the first to run into this roadblock. Switching off Avira realtime checking makes me very uncomfortable and I did only by switching off internet access simultaneously but this only makes things a lot more unworkable of course .

Please help

Peter

Option1: Try use to code using WSL it is a Container Environment in Windows.

Option2: Go copiling the code in %TEMP% and Avira understand it is a strange action by a not assigned software. Change the default folder of Go editing Variables GOTMPDIR

set GOCACHE=C:\go-cache
set GOTMPDIR=C:\go-tmp

After add in Avira exception to ignore this folder.
C:\go-cache e C:\go-tmp

2 Likes

Thanks Antonio, want to give option 2 a try. Will supply an update on my findings . A question upfront I do have is : I understand the two directories for building but once that is done wont it try to copy the main.exe (or whatever) to my go project dir which is different on every project and will block the copying of the file ?

Peter

Hi Antonio,

did some work but it turned out to be a complete disaster changing my current “default” go env settings. After changing them (might have made a typo and so referring to a non existent dir) the entire go command was not available anymore, in vsc the language server crashed etc. Ultimately had to retract on everything and reinstall the go compiler. What I would like to do is not change anything there anymore but solely configure Avira folder exceptions list. Question then is how ? My current settings for the 3 ? paths involved are as follows:

GOPATH=C:\Users\Moniq\go

GOCACHE=C:\Users\Moniq\AppData\Local\go-build

GOTMPDIR=

If I select a dir in Avira for an exception I assume that it ignores this directory and everything below that?

In that case I need to block Avira for :

C:\Users\Moniq\go or possibly C:\Users\Moniq\go\src , since all my project code is contained in there (and main.exe is copied to a subdir of that GOPATH)

C:\Users\Moniq\AppData\Local\go-build where (in a generated subdir) the building of the executable is done before it tries to copy it to my project folder mentioned above

No idea what to do with an empty GOTMPDIR ?

Hope you can help

Thanks Peter

You must change the value of this Variable GOTMPDIR or the wise will by default appoint to %TEMP% and Avira will alert each building.

You can check how change Windows variables with this Site:

https://www.computerhope.com/issues/ch000549.htm

I suggest you to check with ChatGPT to direct you about next steps.

https://chatgpt.com/c/69726758-9a24-8331-8878-fa88ed04a9b4

Oke , so if I set the GO env var GOTMPDIR to something like

C:\Users\Moniq\tmp (which currently doesnt exist)

and leave the other two as they are , I need to exclude in Avira the follwing:

C:\Users\Moniq\tmp (Go tmpdir)

C:\Users\Moniq\go\src (project sources)

C:\Users\Moniq\AppData\Local\go-build (GO cache )

Would that be right in your opinion ?

Thanks Peter