首页 > 代码库 > gopath配置

gopath配置

go语言需要配置一个gopath来安放项目,安装完成之后就要设置,完整步骤如下:

$sudo gedit ~/.bashrc

export PATH="$PATH:/home/yangchao/.linuxbrew/Cellar/go/1.6.2/libexec/bin"
export PATH="$PATH:$GOPATH/bin"

export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
export GOPATH=$HOME

 如果只设置 export GOPATH=$HOME 会出现 go env可以看到gopath但是get 代码之后出现 xxx command not found的错误。

gopath配置