Cannot set $GOPATH on Mac OSX

前端 未结 7 1158
迷失自我
迷失自我 2020-12-22 23:34

I\'m trying to set my $GOPATH variable to run some example code on my machine:

$ smitego-example go run main.go 
main.go:5:2: cannot find packag         


        
7条回答
  •  温柔的废话
    2020-12-23 00:10

    The http://www.golang-book.com/guides/machine_setup#osx

    only has instructions for setting the path on ~/.bashrc, not ~/.bash_profile which thanks to this thread was able to get my example file to build.

    export GOPATH=$HOME
    export PATH=$PATH:$GOPATH/bin
    

    Other Mac users need to add the above to their ~/.bash_profile.

提交回复
热议问题