5 ms·
Yes, never use go build, always use go install! go build builds everything, whereas go install does an incremental build on the stuff that has changed and inst
by nickcw 10y ago
Yes, never use go build, always use go install!
go build builds everything, whereas go install does an incremental build on the stuff that has changed and installs it (either in GOPATH/bin or GOPATH/pkg).
- jjnoakes 10y agoWhy does "go build" build more than what is necessary for "go install"? Shouldn't "go build" just do incremental builds and be faster across the board?
- ithkuil 10y agoFYI, there is also `go build -i`, which is behaves like `go build` in terms of what executable artefacts it produces and where it puts them (i.e. it doesn't install stuff in $GOPATH/bin) but preserves object files for all the dependent packages like `go install` does