“unrecognized import path” with go get

后端 未结 9 776
你的背包
你的背包 2020-12-07 18:00

I\'m trying to install a web.go, but running go get github.com/hoisie/web returns

package bufio: unrecognized import path \"bufio\"         


        
9条回答
  •  爱一瞬间的悲伤
    2020-12-07 18:48

    The issues are relating to an invalid GOROOT.

    I think you installed Go in /usr/local/go.
    So change your GOROOT path to the value of /usr/local/go/bin.

    It seems that you meant to have your workspace (GOPATH) located at /home/me/go.

    This might fix your problem.
    Add this to the bottom of your bash profile, located here => $HOME/.profile

    export GOROOT=/usr/local/go
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOROOT/bin
    

    Make sure to remove the old references of GOROOT.

    Then try installing web.go again.

    If that doesn't work, then have Ubuntu install Go for you.

    sudo apt-get install golang

    Video tutorial: http://www.youtube.com/watch?v=2PATwIfO5ag

提交回复
热议问题