sg: Make detection of sg install target more robust
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:
-
asdf
Go andGOPATH
/GOBIN
set -
asdf
Go andGOBIN
unset (asdf
sets GOPATH by default) - homebrew global Go,
GOPATH
/GOBIN
set - homebrew global Go,
GOPATH
/GOBIN
unset
In all 4 cases the output by install.sh
was correct.