Golang Environment Configuration and installation

Source: Internet
Author: User
Tags sublime text
This is a creation in Article, where the information may have evolved or changed.

Do not know what is called Golang please Google, for do not know go program ape, please wall. Although has been doing front-end development, but learning something is always good, just make a record of some simple things, for later need not forget, only for Mac.
Go Download Address
Because it's version 1.6, download it directly.
Go1.6.darwin-amd64.tar.gz
Throw to your own document path decompression can be, this path can actually be based on personal preferences, but configured Gopath and goroot when paired
Set the path in the. bash_profile

export GOPATH=/Applications/Goexport GOROOT=~/Documents/goexport PATH=${PATH}:$GOPATH/bin:$GOROOT/bin

Save. bash_profile file, restart Terminal, of course, with the source command is also OK.
For children's shoes that do not know. bash_profile file, explain two sentences: this is similar to the configuration of the system path in Windows a file, can not find where, please Google!
The command line executes the Go Version command, and if the installation succeeds, the current go release is displayed.

Next is the code editing environment problem, for this everyone has a different answer. Sublime text loaded with a Gosublime plug-in package, after installation remember to set:

{   "env": {        "GOPATH": "$HOME/Applitaions/Go"    }}

In Liteide, to set the

GOROOT=$HOME/Documents/go

Then start writing go, under/applitaions/go new three folder src,pkg,bin~ code must be under SRC.

package mainimport (    "fmt")func main() {    fmt.Println("Hello Golang~!")}
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.