cmd/go: default GOBIN to GOPATH[0]/bin when outside of GOPATH? #23439
Comments
Arguments of $ go get github.com/nats-io/go-nats-streaming
$ go install github.com/nats-io/go-nats-streaming/examples
$ or $ go build /go/src/github.com/nats-io/go-nats-streaming/examples/stan-pub.go |
Thanks @cznic for your comment. What I understand from documentation and implementation is that the name of the argument is
Notice there
If one Second suggestion, to This ticket is intended to fix the inconsistency in |
The use of GOPATH/bin only applies to packages stored in GOPATH. go install /other/file.go is not considered to be in any GOPATH, so it can only use GOBIN. In the long term, with modules, we expect that people will stop setting GOPATH and then GOBIN may be more important (or maybe it will increase pressure to default to GOPATH[0]/bin). |
FWIW I would put the examples in subdirectories and then you can |
Note that if we do make GOBIN effectively default to GOPATH[0]/bin, then we could make 'go env GOBIN' show that default. |
See also #29005. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
@jayconrod, @matloob: I think we should address this in Go 1.15. The inability to rely on |
sounds good to me |
Change https://golang.org/cl/232017 mentions this issue: |
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Linux, amd64
What did you do?
What did you expect to see?
/go/bin/stan-pub
binary installed, consistent with the requirements whengo install <package>
is used, just GOPATH is set and that should be enough, GOBIN should not be required.What did you see instead?
Error message:
go install: no install location for .go files listed on command line (GOBIN not set)
The text was updated successfully, but these errors were encountered: