This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: Use 'go install ...' for the install target (#949)
GOBIN (documented in [1]) defaults to DIR/bin, but it's a configurable variable in its own right. The old logic was just looking at GOPATH, though, and not respecting GOBIN. This commit updates our install target to lean on Go's build caching (instead of using Make's dependency trees) to ensure a fresh-enough build lands in the appropriate directory. This approach relies on Go 1.10+ to avoid [2], but we've required Go 1.10+ since b859ebf (Documentation/development: Bump minimum Go version to 1.10, 2018-04-03, #955). For the build documentation, I've switched to 'go env GOPATH' to get the (platform-specific [1]) default value when the environment variable is not set. And I've used cut [3] (instead of the awk [4] the Makefile used to use) to pull out the first component of GOPATH. Both are in POSIX, but cut is a simpler tool for this particular problem. [1]: https://golang.org/cmd/go/#hdr-GOPATH_environment_variable [2]: golang/go#18981 [3]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html [4]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
- Loading branch information