Mac OSX Go development Environment Building (liteide)

Source: Internet
Author: User
Tags create directory mirror website
This is a creation in Article, where the information may have evolved or changed.

1. Download go

Website download address (need to turn over the wall)
Golang

China Mirror website Download
Golangtc

Download the go1.5.1.darwin-amd64.tar.gz package, unzip to get a go directory, move the go directory to the path you want, I'm here to put it ~/Documents/go under this path

2. Configure Environment variables

Open the terminal using vim .bash_profile the command to open the configuration file and modify the save, add the following statement

 #GOPATH export GOPATH=~/Applications/Go #GOROOT export GOROOT=~/Documents/go #PATH export PATH=$GOROOT/bin:$GOPATH/bin:$PATH

GOROOTThe variable is the path to the downloaded go directory, which GOPATH must be set, and not the same as the Go directory, which is GOROOT used to store the go source, go executable files, and the corresponding compiled package files. So there are three subdirectories under this directory: src, bin, pkg. Here I ~/Applications/ create a new Go directory, and in the Go directory of the new SCR, bin, pkg three directory.

More in-depth understanding of GO environment variables or learning can read the book below
Build-web-application-with-golang

Configuration complete save after exiting, run the following command to make the environment variable effective
source .bash_profile

3. Download the installation configuration Liteide

Download Address
Liteide Download

After installation open Liteide Edit the current environment, where the configuration and the previous GO environment variable configuration, in fact, the previous environment variable configuration can be ignored, here to configure

查看->编辑当前环境Open it

Configured as follows

# native compiler drawin amd64GOROOT=$HOME/Documents/goGOPATH=$HOME/Applications/GoGOBIN=GOARCH=amd64GOOS=darwinCGO_ENABLED=1PATH=$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.Hello World

$GOPATH/src/under Create directory hello use liteide Open Directory, create filemain.go

package mainimport "fmt"func main(){    fmt.Println("Hello world!")}

Click on the BR button above to run the build and run

Related Article

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.