Compile all your dependencies
What I've noticed some time ago is that if you change the version of Go the libs stay at old version. This causes them to be built on eachgo run
you invoke. And if you use a library which
automates rebuilding the binary on change like reflex () than you may wait long.
List all deps
To list all dependencies your application or library have you can invoke:go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' > deps
(borrowed from from go-nuts)
Rebuild all packages
After that you can call:go install -a $(tr -d '\n' < deps)
Update all packages
Alternative to the above, updates the code:go install -u $(tr -d '\n' < deps)
Speedup
For my code it was from 15 seconds to below 1 second.
Apply to all subpackages in a project
As Craig Furman suggested in a comment (thanks):go list -f '{{.Deps}}' ./... | tr "[" " " | tr "]" " " | \
xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | \
xargs go install -a