Ubuntu 16.04 Go Environment build +sublime configuration

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

1. Install Go

Download address https://golang.org/dl/(need to be turned down)

After downloading to a similar go1.8.3.linux-amd64.tar.gz installation file

    1. Performtar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz
    2. Adding environment variablesexport PATH=$PATH:/usr/local/go/bin
    3. Choose a location to put go items (usually ~/go/ )
    4. Continue to add environment variable Goroot to set the directory export GOROOT=~/go for the Go Projectexport PATH=$PATH:$GOROOT/bin
    5. Enter the command at any path go version , the version output proves that the configuration was successful

2. Configure Sublime

    1. Install the package Control
      CTRL + ' shortcut key to bring up the console, enter the following code to install Paackge control
       import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
    2. Ctrl+shift+p Open the Package controll input PCIP (the abbreviation for the "Package Control:install package").
      Install in sequence

      • Gosublime
      • Sidebarenhancements
      • Golang Build
    3. Installing Gocode
      Terminal inputgo get github.com/nsf/gocode

After restarting sublime, you can feel the automatic code hints for auto go.

3. Set Sublime Build

If you want sublime to build the Go project directly, you need to modify the Golang Config

Open Package Setting, Golang Config, Settings-user, enter

{    "osx": {        "PATH": "/Users/jsmith/go/bin",        "GOPATH": "/Users/jsmith/go"    },    "windows": {        "PATH": "C:\\Users\\jsmith\\go\\bin",        "GOPATH": "C:\\Users\\jsmith\\go"    },    "linux": {        "PATH": "/usr/local/go/bin",        "GOPATH": "/home/userName/go"    }}

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.