在Ubuntu上优化Golang编译速度可从以下方面入手:
go build -p 4
export GOCACHE=$HOME/.cache/go
go build -buildcache=true
go build -ldflags "-s -w"
go build -modvendor
go env -w GOPROXY=https://goproxy.cn,direct
参考来源: