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 not working #72

Closed
grantstephens opened this issue Mar 20, 2019 · 6 comments
Closed

$GOPATH is not working #72

grantstephens opened this issue Mar 20, 2019 · 6 comments

Comments

@grantstephens
Copy link

On the latest master (20/3/19) it seems that the exported environment variable GOPATH is not passed to go as running go env gives /home/$user/go/$goversion and not whatever $GOROOT is set to.

@syndbg
Copy link
Member

syndbg commented Mar 20, 2019

Thanks! I'll check it out and verify

@d-kuro
Copy link

d-kuro commented Mar 21, 2019

I use fish shell, solved this by deleting eval (goenv init-| source) which I wrote in fish.config

@blockloop
Copy link

blockloop commented Mar 29, 2019

The change is described in the commit message of f9a06ed. @grantstephens you need to export GOENV_DISABLE_GOPATH=1 before eval "$(goenv init -)"

Here's my rc

export GOENV_DISABLE_GOPATH=1
export GOENV_VERSION=$(goenv versions --bare | tail -n1)
export GOPATH="$HOME/go"
eval "$(goenv init -)"
goenv global "${GOENV_VERSION}"

@syndbg
Copy link
Member

syndbg commented Apr 9, 2019

@grantstephens @d-kuro @blockloop Hey, my takeaway from the issue is that the documentation was lacking since you had to check the commit to better understand the usage.

I've added the GOPATH and GOROOT-related env vars to https://github.com/syndbg/goenv/blob/master/ENVIRONMENT_VARIABLES.md

I think it's resolving the issue. What do you think?

P.S I've referenced your comment @blockloop . Cool usage of export GOENV_VERSION=$(goenv versions --bare | tail -n1) :)

@d-kuro
Copy link

d-kuro commented Apr 9, 2019

@syndbg thanks!

@syndbg syndbg closed this as completed Apr 9, 2019
@timhughes
Copy link

timhughes commented Apr 21, 2019

@blockloop @syndbg you may want to add a sort in there by version.

$ goenv versions --bare
1.10.2
1.11.0
1.5.4

When you have pre 1.10 versions you get the following which is quite obviously wrong

$ goenv versions --bare | tail -n1
1.5.4

But sort has the ability to sort by semver (at least on linux it does)

$ goenv versions --bare|sort --version-sort
1.5.4
1.10.2
1.11.0

So you then get what you are after

$ goenv versions --bare|sort --version-sort|tail -n1
1.11.0

Opened a issue for this #81

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

No branches or pull requests

5 participants