Build a Go language development environment in Linux, Windows, and Mac

Source: Internet
Author: User
Tags install go mercurial

Build a Go language development environment in Linux, Windows, and Mac

Go language Official Website: https://golang.org/


Windows:

Download the go1.6.windows-amd64.msi installation file from the official website. Select the default installation path C: \ Go \
After installation, configure the environment variable Path: C: \ Go \ bin;
Next, create a GOPATH environment variable. This variable is very important. The code I wrote should be placed in the directory configured in this variable, and the go compiler will find and compile it;
Create a GOROOT variable, and use the GOROOT: C: \ go \; variable installed with the Go compiler \;
After completing the preceding steps, open the command line and enter # go version. The go compiler version is displayed.
Enter # go env to view the correct go environment.

Linux:

To deploy golang in Linux, first install the SSH remote tool on windows, such as Xshell4.
1. Install the mercurial package (the mercurial version management system can output the hg name to check whether the package is installed)

  • Sudo apt-get install mercurial or # sudo easy_install mercurial
    2. Install git
  • Sudo apt-get install git
    3. Install gcc
  • Sudo apt-get install gcc
    4. Download The golang compressed package
  • Wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
  • Tar-zxvf go1.6.linux-amd64.tar.gz-C/home
    Rename the decompressed folder to go
    Add environment variable: # vi/etc/profile
    Add the following content to profile:
    Export GOROOT =/home/go
    Export PATH = $ GOROOT/bin: $ PATH
    Export GOPATH =/home/gopkg
    Change GOPATH and GOROOT to your path.
    Then we refresh the environment variable: # source/etc/profile
    Finally, verify whether the installation is successful: # go version
    5. We can also install golang without downloading the compressed package.
  • Sudo apt-get install golang
  • Go version
Mac:

Download the go1.6.darwin-amd64.pkg installation file from the official website.
Alternatively, run the following command after installing homebrew:

  • Brew update
  • Brew install mercurial
  • Brew install go
    .
    Enter # go version to see the version number of the go compiler.
    Enter # go env to view the correct go environment.
I chose IDEA + go plugin as the development tool.

Websites: https://github.com/go-lang-plugin-org/go-lang-idea-plugin

Install go plugin:
  1. File-> Setting, select "Plugins" on the left side of the Settings dialog box, and click "Browse repositories ",

  2. Select Plugins on the left side of the Settings dialog box, Click Browse repositories, and click the Manage respositories button below.

  3. In the Custom Plugin Repositories dialog box, click the + button.

  4. In the "Add Repository" dialog box, enter the address of the go language plug-in: https://plugins.jetbrains.com/plugins/alpha/5047, and click OK .

  5. In the Custom Plugin Repositories dialog box, click OK.

  6. Next, find the "Go" plug-in on the left side of the "Browse Repositories" dialog box and click "Install.

  7. After the restart, the Go language plug-in is installed.

  8. File-> Project Structure: add the Go SDK to the SDKs.


     

Start to create the first go language program and run it:


 

OK. The go language development environment has been set up here. enjoy it ~

Getting started with Linux-installing Go in Linux

Install Go Language Pack in Ubuntu

Go language programming (HD) full-version ebook

Go language and beauty-surpassing "Hello World"

Why do I like the Go language?

Implementation of the Go language memory distributor

This article permanently updates the link address:

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.