Stefan Bollmann
Stefan Bollmann

Reputation: 720

Go bin in PATH, but "go version" fails

How can I use go using the standard installation instructions in bash? What do I do wrong?

I followed the installation instructions for go on Linux. Therefore I downloaded the go tar.gz, untared it to /usr/local and added export PATH=$PATH:/usr/local/go/bin to /etc/bash.bashrc and made a source /etc/bash.bashrc.

However, go version does not give the proper result. See:

user@machine:~$ which go
/usr/local/go/bin/go
user@machine:~$ go version
user@machine:~$ /usr/local/go/bin/go version
go version go1.11.5 linux/amd64

user@machine:~$ type -a go
go is a function.
go () 
{ 
    eval dir=\$$1;
    cd "$dir"
}
go is /usr/local/go/bin/go

Upvotes: 1

Views: 311

Answers (1)

Keith Thompson
Keith Thompson

Reputation: 263257

Shell functions take priority over commands in your $PATH.

which doesn't necessarily find shell functions (in fact I don't think it can find them at all). type -a is more reliable, at least if you're using bash or another sh-derived shell.

The problem is that you have an unrelated shell function called go.

If you still want that function, I suggest giving it a different name, Go would work.

Upvotes: 4

Related Questions