Skip to content

cmd/go: GOROOT issue using fish shell #21298

Closed
@walteraa

Description

@walteraa

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?

Activity

walteraa

walteraa commented on Aug 3, 2017

@walteraa
Author

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

davecheney commented on Aug 4, 2017

@davecheney
Contributor
zegl

zegl commented on Aug 4, 2017

@zegl
Contributor

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

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

davecheney

davecheney commented on Aug 4, 2017

@davecheney
Contributor

Closing based on @zegl 's comment.

walteraa

walteraa commented on Aug 4, 2017

@walteraa
Author

Thank you @zegl

changed the title [-]GOROOT issue using fish shell[/-] [+]cmd/go: GOROOT issue using fish shell[/+] on Aug 7, 2017
locked and limited conversation to collaborators on Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @davecheney@zegl@walteraa@gopherbot

        Issue actions

          cmd/go: GOROOT issue using fish shell · Issue #21298 · golang/go