Go Temp Folders for AV Exclusion

I’m having stupid long build times in Windows 11 recently, and I suspect it has to do with AV.

I’m looking for an official list of locations that can be added to the exclusion list or instructions for how to properly exclude Go and relevant build functions.

Is there such a list somewhere?

Hi @sivan, I don’t know about such a list, but I’d reckon that it might be sufficient to exclude %GOPATH% and the current project directory from AV scanning.

(%GOPATH% contains the cache for downloaded modules as well as build artifacts.)

Those still didn’t work. Maybe there are other locations, or maybe it’s what Go does in memory. The only workaround I’ve found is to disable the following in the Windows Security Center:
Cloud-Delivered Protection
Automatic sample submission
With those disabled, Go builds fast again.

This is interesting. And I suppose Microsoft does not document what these two options do under the hood.
But at least you have a workaround.

We can make an educated guess; when you attempt to run your .go it halts before execution, uploads your binary to Microsoft’s servers where they are scanned, waits for approval, and only then begins execution. That’s maybe fine the first time you run a new application, but it’s obviously very annoying when it’s repeated every time you execute “go build/test/run.”
I think, since this is now enabled by default, it might make sense for the Go community to consider updating the installer and/or documentation for the Windows version.


If you use go run you will probably need to add the temporary folder to the exclude list, where the binary is created. go debug will also usually create a temporary file which is executed.

You can also test go build and then run your file to make sure if it is the build process or execution of the binary which is slow.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.