Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$GOPATH is unset #25

Closed
asdwsda opened this issue Sep 25, 2019 · 5 comments · Fixed by #29
Closed

$GOPATH is unset #25

asdwsda opened this issue Sep 25, 2019 · 5 comments · Fixed by #29

Comments

@asdwsda
Copy link

asdwsda commented Sep 25, 2019

$GOPATH is unset during image build, and because of that, $PATH would be wrong as well.

Expected (let's assume that GOPATH='/go')

$ echo $PATH
/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Actual:

$ echo $PATH
/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Notice that /bin is duplicated.

@FelicianoTech
Copy link
Contributor

Looking into this.

@FelicianoTech
Copy link
Contributor

@asdwsda It's looking to me that GOPATH is deprecated as of Go v1.13.

The biggest use I still see for it is when go get installing binaries, which not only should be used less and less, but shouldn't be a CI activity in my opinion.

Can you explain your use-case here?

@asdwsda
Copy link
Author

asdwsda commented Sep 30, 2019

You are right, GOPATH is deprecated in Go v1.13. However this repo contains v1.12 and v1.11 as well. What about these versions?

I agree with you. Installing binaries shouldn't be a CI activity, but sometimes I need to do it. I think it is expected to be able to use go get and installed bins in such containers.

What do you think about setting GOBIN instead of GOPATH?

GOBIN
The directory where 'go install' will install a command.

@FelicianoTech
Copy link
Contributor

GOBIN might be viable. Looking into this and will decide on something soon.

FelicianoTech added a commit that referenced this issue Oct 8, 2019
While the default working directory won't place users in the GOPATH, it
will still be useful to have around for older projects who want to use
it.

Fixes #25
@FelicianoTech
Copy link
Contributor

@asdwsda I did some testing.

  1. go get will assume a GOPATH for you when installing a binary if one isn't set. That being said, the resulting location still wasn't in PATH so not really useful.
  2. GOBIN was a good idea and would work. While doing some testing, it felt like a half-measure to just properly fixing GOPATH so I just did that instead.
  3. PR Set GOPATH to a root go directory. #29 will make GOPATH and PATH work for Go binaries.

FelicianoTech added a commit that referenced this issue Oct 8, 2019
While the default working directory won't place users in the GOPATH, it
will still be useful to have around for older projects who want to use
it.

Fixes #25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants