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

cmd/go: GOROOT issue using fish shell #21298

Closed
walteraa opened this issue Aug 3, 2017 · 5 comments
Closed

cmd/go: GOROOT issue using fish shell #21298

walteraa opened this issue Aug 3, 2017 · 5 comments

Comments

@walteraa
Copy link

walteraa commented Aug 3, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.3 linux/amd64

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

I'm using fish shell and the GOROOT is seted in my config.fish file

➜  kubernetes git:(master) cat $HOME/.config/fish/config.fish 
set TERM xterm-256color

set GOPATH $HOME/go
set PATH $GOPATH $PATH
set GOROOT $HOME/.programs/go

set PATH $GOROOT/bin $PATH 
set PATH $GOPATH $PATH
set PATH $GOROOT $PATH

# kubernetes development environment
set working_dir $GOPATH/src/k8s.io
set user walteraa

I have verified if GOROOT is defined correctly, as you can see below

➜  kubernetes git:(master) echo $GOROOT
/home/walteralves/.programs/go

I have a similar configuration in my .bashrc, as you can see below

export GOPATH=$HOME/go
export GOROOT=$HOME/.programs/go
export working_dir=$GOPATH/src/k8s.io
export user=walteraa

What did you expect to see?

When I am in bash shell, and a run go env, everything looks good

walteralves@carvalheira-pc-198:~/go/src/k8s.io/kubernetes$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/walteralves/go"
GORACE=""
GOROOT="/home/walteralves/.programs/go"
GOTOOLDIR="/home/walteralves/.programs/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build463961936=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you see instead?

But, when I am in the fish shell, my GOROOT isn't updated correctly, but the GOPATH is

➜  kubernetes git:(master) go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/walteralves/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build753890953=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

There some way to fix it in my fish environment?

@walteraa
Copy link
Author

walteraa commented Aug 3, 2017

Notice: I did a workaround to make my environment work(I have created a symbolic link to my GOROOT in the /usr/local folder.

@davecheney
Copy link
Contributor

davecheney commented Aug 4, 2017 via email

@zegl
Copy link
Contributor

zegl commented Aug 4, 2017

You are not using set correctly: https://fishshell.com/docs/current/commands.html#set

Use set -gx GOROOT $HOME/.programs/go instead.

@davecheney
Copy link
Contributor

Closing based on @zegl 's comment.

@walteraa
Copy link
Author

walteraa commented Aug 4, 2017

Thank you @zegl

@mikioh mikioh changed the title GOROOT issue using fish shell cmd/go: GOROOT issue using fish shell Aug 7, 2017
@golang golang locked and limited conversation to collaborators Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants