如題:在設置了~/.bashrc 之後當前的Terminal是可以使用go env查看golang信息的。這個時候重啓新的Terminal發現又不行了。這個時候需要編輯~/.bash_profile。記得使用root權限打開編輯。
輸入如下:export GOROOT=/usr/local/opt/go\@1.12/libexec
export PATH=$PATH:$GOROOT/bin
這裏注意不是go目錄而是下面的libexec文件夾。然後source ~/.bash_profile。