sh 使用HomeBrew在Mac OSX中设置Golang。在zshell,fish或bash中设置`GOPATH`和`GOROOT`变量。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用HomeBrew在Mac OSX中设置Golang。在zshell,fish或bash中设置`GOPATH`和`GOROOT`变量。相关的知识,希望对你有一定的参考价值。

echo "Please enter your golang path (ex: $HOME/golang) :"
read gopath

echo "Please enter your github username (ex: vsouza) :"
read user


mkdir $gopath
mkdir -p $gopath/src/github.com/$user

export GOPATH=$gopath
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install go
brew install git
brew install mercurial

go get golang.org/x/tools/cmd/godoc
go get golang.org/x/tools/cmd/vet
# Set variables in config.fish file

# don't forget to set path correctly!

# GOLANG configurations
set -x GOPATH $HOME/golang
set -x GOROOT /usr/local/opt/go/libexec
set PATH $GOPATH/bin $GOROOT/bin $PATH
# Set variables in .zshrc file

# don't forget to set path correctly!

export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
# Set variables in .bashrc file

# don't forget to change your path correctly!

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

以上是关于sh 使用HomeBrew在Mac OSX中设置Golang。在zshell,fish或bash中设置`GOPATH`和`GOROOT`变量。的主要内容,如果未能解决你的问题,请参考以下文章

sh 使用HomeBrew在Mac OSX中设置Golang 1.5。在zshell或bash中设置`GOPATH`和`GOROOT`变量。

如何在 XAMPP mac osx lion 中设置 memcache

在 Cocoa Mac OSX 中设置 FirstResponder 的问题

工具Homebrew的安装及使用

Fink 和 Homebrew - 他们可以在 mac osx 上一起生活吗?

在 CLion 中设置 OpenMP 项目 MacOS Mojave