Skip to content

sg: Make detection of sg install target more robust

Warren Gifford requested to merge mrn/sg-robust-install into main

Created by: mrnugget

With GOBIN and GOPATH unset go install did not install sg to the directories described in the linked documentation.

But it did install it to the location that I could find with go list -f '{{.Target}}'.

That is also the recommended way to discover the install target here: https://golang.org/doc/tutorial/compile-install

I tested this locally in 4 different environments:

  1. asdf Go and GOPATH/GOBIN set
  2. asdf Go and GOBIN unset (asdf sets GOPATH by default)
  3. homebrew global Go, GOPATH/GOBIN set
  4. homebrew global Go, GOPATH/GOBIN unset

In all 4 cases the output by install.sh was correct.

Merge request reports

Loading