Add a new system variable GOTMPDIR
- Edit the system environment variables.
- Go to the
Advanced
tab - Click
Environment variables
- System Variables -> New ->
GOTMPDIR=C:\Temp\GoBuilds
To speed up go on Windows without disabling the antivirus.
- Add the working dir to the Avira exclusion list
- powershell
$env:GOTMPDIR = "C:\Temp\GoBuilds"
- `go run -work .\hello.go
I figured out what was causing the slowness after running the same build commands on 10 years old Mac Book Pro.
The problem was caused by the antivurus on my Windows laptop, disabling it fixed the issue
- Install go from go.dev
- Install vs code
- Install go plugin
- View/ Command Palette / Go Install/Update tools
For some reason go run .
takes a very long time to execute
So I use go build .
.\hello.exe