2019-02-10 22:07
浏览 258


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
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
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqyuipw44576
    dqyuipw44576 2019-02-10 22:31

    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.

    点赞 评论