Mac installs Golang and Liteide

Source: Internet
Author: User

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

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.