Cannot set $GOPATH on Mac OSX

前端 未结 7 1163
迷失自我
迷失自我 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 accepted answer didn't work for me. I investigated and found the cause: I am using zsh, not bash.

    I need to add the following two lines to ~/.zshrc:

    export GOPATH=/Users/username/go
    export PATH=$GOPATH/bin:$PATH
    

提交回复
热议问题