Why go build
or go test
is so slow on Windows
Problem
When you run go build
or go test
on Windows, it is very slow.
If go build
costs
Reason
The reason is that Windows Defender scans the files generated by go build
or go test
in real time, which causes the slow.
Solution
Exclude the files used by go
:
%userprofile%\go\
%localappdata%\go-build\
<YOUR GO CODE DIR>
, e.g.%userprofile%\JetBrains\
- Open Windows Defender Security Center
- Click “
Virus & threat protection ” - Click “
Virus & threat protection settings ” - Click “
Add or remove exclusions ” - Click “
Add an exclusion ” - Click “
Folder ” - Select the above folders one by one
BTW
Maybe you can also exclude the process go.exe
in “