-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Both $GOPATH
or $GOROOT
are not set & request for a custom place to use my installed go version
#28
Comments
I've found this alias is useful alias go-reshim='asdf reshim golang && export GOV=$(asdf current golang | sed '\''s/ *(set by .*)//g'\'') && export GOROOT="$ASDFINSTALLS/golang/$GOV/go/"' I have this alias called in my |
+1 for this. Also, it'd be great if the |
I generally set my defaults in |
Any advantages you see to trying to handle that here? I mean I could see setting them in the env hook if they’re not already set. Thoughts? |
Any solution? |
it'd be good to document this in readme - what user needs to do for these to be set properly with |
I recently had this issue while using After some debugging, I realized one of the differences between the two was that https://github.com/actions/setup-go sets It would be great if |
Thanks, this has indeed been helpful. I made a slight modification since the sed parsing didn't quite work for my version of asdf. alias go-reshim='asdf reshim golang && export GOROOT="$(asdf where golang)/go/"' |
@ggilmore So looking at your case it seems like other tools need to know where the I'm still game to do something if we can figure out a clean way to update the env, but I don't know anything off hand. 🤔 |
@RafalSkolasinski What do you have in mind when you say?
Are you asking what you should add to an envrc file or something like that? |
Could something like what the Java plugin does work here as well, with |
Using https://github.com/asdf-community/asdf-direnv with global |
@Matts966 can you give us an example or snippet from your configs please to help us how we can do it. |
@MuhmdRaouf
You can refer official doc for other shells. Edit: Maybe I misunderstood the problem. We should set additional Edit2: You can add root |
Why do we need
|
That's where things that you asdf puts ~/.asdf/shims at the front of your path, so no matter what version you select, your shell will find the binary. I fell into using asdf-direnv, but for the increased performance when opening a shell (evaluating takes a long time for some reason). Key thing is to not set any of the Go env vars as shell env vars - let ASDF manage them. |
After I thought I had it fixed with some of the previous suggestions, what ended up working for both GOPATH and GOROOT with repo-specific # go
export GOPATH=$(asdf where golang)/packages
export GOROOT=$(asdf where golang)/go
export PATH="${PATH}:$(go env GOPATH)/bin" |
@pythoninthegrass 's solution worked beautifully for me! |
🤙
…________________________________
From: Drew Daniels ***@***.***>
Sent: Thursday, September 14, 2023 12:17:58 PM
To: asdf-community/asdf-golang ***@***.***>
Cc: pythoninthegrass ***@***.***>; Mention ***@***.***>
Subject: Re: [asdf-community/asdf-golang] Both `$GOPATH` or `$GOROOT` are not set & request for a custom place to use my installed go version (#28)
@pythoninthegrass<https://github.com/pythoninthegrass> 's solution worked beautifully for me!
—
Reply to this email directly, view it on GitHub<#28 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA7ILP2LBSOZ4HWKPBSYMWLX2M34NANCNFSM4K2E4IYQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Describe the bug
Both
$GOPATH
or$GOROOT
are not.To Reproduce
Steps to reproduce the behavior:
$GOPATH
or$GOROOT
Expected behavior
To Have
$GOPATH
&$GOROOT
set.Desktop (please complete the following information):
Additional context
Can I add a sort of Place to put my
$GOPATH
&$GOROOT
as I want them to be inside ofgo
folder inside of my home directory and the library append on it.eg: installing go 1.13.8 with the following environment variable
ASDF_GOLANG_CUSTOM_PATH=$HOME/go
so my
$GOPATH
&$GOROOT
set as the following$GOPATH=ASDF_GOLANG_PATH/1.13.8/......
$GOROOT=ASDF_GOLANG_PATH/1.13.8/......
The text was updated successfully, but these errors were encountered: