Mac installs Golang and Liteide
1. Download go
Download Address: Https://www.golangtc.com/download
Mac Download: go1.9.2.darwin-amd64.tar.gz, unzip to a go directory, move the go directory to the path you want, I placed under ~/go this path.
2. Configure Environment variables
Open terminal, enter commandvim .bash_profile
Add the following configuration:
#GOPATHexport GOPATH=~/Applications/Go#GOROOTexport GOROOT=~/go#PATHexport PATH=$GOROOT/bin:$GOPATH/bin:$PATH
GOROOTThe variable is the path to download the extracted go directory, GOPATH is a variable, must be set, and can not drink Go's installation directory as well as Goroot, this directory is used to store go source, go executable files, as well as the corresponding mutation package file. So there are three directories under this directory: src, bin, pkg. I have ~/Applications/ created a go directory below, and I have built the src, bin, pkg three directories.
Configuration complete Save exit, execute the following command to make the configuration take effect.
source. bash_profile
3, download the installation configuration Liteide
Download Address: Https://golangtc.com/download/liteide
After downloading, open liteide Edit the current environment, here configuration and the previous GO environment variable configuration, in fact, money to buy the environment variable configuration can be ignored, directly to the configuration here. View-"Edit the current environment to open."
# native compiler darwin amd64GOROOT=$HOME/goGOPATH=$HOME/Applications/GoGOBIN=GOARCH=amd64#OOS=darwinCGO_ENABLED=1#PATH=$GOROOT/bin:$PATH:/usr/local/bin#PATH=$PATH:/usr/local/binPATH=$GOROOT/bin:$GOPATH/bin:$PATHLITEIDE_GDB=/usr/local/bin/gdbLITEIDE_MAKE=makeLITEIDE_TERM=/usr/bin/openLITEIDE_TERMARGS=-a TerminalLITEIDE_EXEC=/usr/X11R6/bin/xtermLITEIDE_EXECOPT=-e
After saving the exit, the build is complete.
4. International Practice Hello World
$GOPATH/src/under Create directory hello , use Liteide to open the directory, createtest.go
// testpackage mainimport ( "fmt")func main() { fmt.Println("Hello World!")}
Then click on the BR button above to run