Build a Go Language compilation environment in Mac OS

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

1. Go to http://golang.org to download the go installation package and install it in a fool's style

2. After the installation is complete, you can open the terminal input GO command to detect whether the installation was successful

3. You can enter go version to view the installed Go versions

4. Environment variable Configuration

    • Gopath is used to tell the Golang command and other related tools where to find the Go package directory on your system. Gopath is a list of paths, similar to the settings for path
gopath=/home/user/go:/home/user/workspace_go:***

The path to each list item is actually a workspace, and each workspace should contain three directories for the source file (SRC), the related package (pkg), and the execution file (bin).

Method:

A. Modify the ~/.bash_profile file to add code similar to the following:

Export Gopath=/users/heinoc/go:/users/heinoc/documents/workspace/workspace_go

B. Save the file, exit and execute the source ~/.bash_profile make the configuration take effect

C. Use go env to view configuration results

5. Sublime Text 2 Installation

Easy and quick installation for Dummies

    • Install the package Control: Open sublime, press CTRL + ' on the command line, and then execute the following command:
Import Urllib2,os; pf='Package Control.sublime-package'; Ipp=sublime.installed_packages_path (); Os.makedirs (IPP)ifNot Os.path.exists (IPP)ElseNone; Urllib2.install_opener (Urllib2.build_opener (urllib2. Proxyhandler ())); Open (Os.path.Join(IPP,PF),'WB').Write(Urllib2.urlopen ('http://sublime.wbond.net/'+pf.replace (' ','%20'). read ()); Print'Restart Sublime Text to finish installation'
    • Before and after plastic surgery:

    • Installing the Gosublime Plugin

Command + Shift + P opens the package Control and then enters PCIP (the abbreviation for the Control:install), enters the gosublime in the subsequent interface, and the carriage return can be installed.

To this, the Sublime Text 2 + Gosublime's Go language development environment is completed

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.