Go Development Environment Configuration

Source: Internet
Author: User

Golang is a compiled, parallel programming language developed by Google. It is simple, fast and safe. Good at memory management, array security, and fast compilation
The go language design supports the mainstream 32-bit and 64-bit x86 platforms, while also supporting the 32-bit ARM architecture. The go language supports Windows, Apple Mac OS X, Linux and FreeBSD operating systems on the GO1 version.

Of course, all language learning starts with setting up the environment (MacOS)

Installing with HomeBrew

Homebrew Installation Reference: http://brew.sh/

$ brew install go
==> Downloading https://homebrew.bintray.com/bottles/go-1.10.3.high_sierra.bottlAlready downloaded: /Users/faremax/Library/Caches/Homebrew/go-1.10.3.high_sierra.bottle.tar.gz==> Pouring go-1.10.3.high_sierra.bottle.tar.gz==> CaveatsA valid GOPATH is required to use the `go get` command.If $GOPATH is not specified, $HOME/go will be used by default:  https://golang.org/doc/code.html#GOPATHYou may wish to add the GOROOT-based install location to your PATH:  export PATH=$PATH:/usr/local/opt/go/libexec/bin==> Summary  /usr/local/Cellar/go/1.10.3: 8,170 files, 336.7MB

After the installation is successful, you need to configure the environment variables to ~/.bash_profile add the following:

#golangexport GOPATH=$HOME/goexport GOBIN=$GOPATH/binexport PATH=$PATH:$GOBIN

Here you can see that you need to set the environment variables for Gopath and Gobin, and set the path.

In order for the modification to take effect immediately, execute:

$ source .bash_profile

To see if the configuration takes effect:

$ go env

Get the following content:

Goarch= "AMD64" gobin= "/users/faremax/go/bin" gocache= "/users/faremax/library/caches/go-build" GOEXE= "" GOHOSTARCH= "AMD64" gohostos= "Darwin" goos= "Darwin" Gopath= "/users/faremax/go" gorace= "goroot="/usr/local/cellar/go/1.10.3/ Libexec "gotmpdir=" "gotooldir="/usr/local/cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64 "GCCGO=" GCCGO "CC=" clang "cxx=" clang++ "cgo_enabled=" 1 "cgo_cflags="-g-o2 "cgo_cppflags=" "cgo_cxxflags="-g-o2 "goarch=" AMD64 "GOBIN="/Users/ Faremax/go/bin "gocache="/users/faremax/library/caches/go-build "goexe=" "gohostarch=" AMD64 "GOHOSTOS=" Darwin "GOOS = "Darwin" gopath= "/users/faremax/go" gorace= "goroot="/usr/local/cellar/go/1.10.3/libexec "gotmpdir=" "GOTOOLDIR=" /usr/local/cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64 "gccgo=" Gccgo "cc=" clang "cxx=" clang++ "CGO_ENABLED=" 1 " cgo_cflags= "-g-o2" cgo_cppflags= "cgo_cxxflags="-g-o2 "cgo_fflags="-g-o2 "cgo_ldflags="-g-o2 "PKG_CONFIG=" Pkg-config "gogccflags="-fpic-m64-pthread-fno-caret-diagnostics-qunused-arguments-fmessage-length=0- fdebug-prefix-map=/vAr/folders/f0/wl0qf7mn1131dc3brmbb3_d00000gn/t/go-build994213970=/tmp/go-build-gno-record-gcc-switches- Fno-common "cgo_fflags="-g-o2 "cgo_ldflags="-g-o2 "pkg_config=" Pkg-config "gogccflags="-fpic-m64-pthread- fno-caret-diagnostics-qunused-arguments-fmessage-length=0-fdebug-prefix-map=/var/folders/f0/ Wl0qf7mn1131dc3brmbb3_d00000gn/t/go-build994213970=/tmp/go-build-gno-record-gcc-switches-fno-common "

The

can be seen, the configuration takes effect, environment variable settings are complete!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.