Configuring the Golang development environment with sublime TEXT3 on Deepin Linux

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

Install Git

Because Golang is managing remote packages through Git, we'll first install git. Refer to the official website for details.

➜ tonny@tonny-pc  ~  sudo apt-get install git➜ tonny@tonny-pc  ~  git versiongit version 2.8.1

Installing Golang

1) First go to https://golang.org/dl/to select the appropriate installation package for your system (inside the wall: http://golangtc.com/download).
2) I choose here: go1.6.3.linux-amd64.tar.gz, Download complete installation to the specified directory. I'm a/usr/local here.
3) After the installation is complete, the environment variable has been set automatically, can be called out Terminal command Line input command to view

➜ tonny@tonny-pc  ~  wget http://golangtc.com/static/go/1.6.3/go1.6.3.linux-amd64.tar.gz➜ tonny@tonny-pc  ~  sudo tar -zxvf go1.6.3.linux-amd64.tar.gz -C /usr/local➜ tonny@tonny-pc  ~  ll /usr/local/go

Configure the work environment

➜ tonny@tonny-pc  ~  mkdir -p $HOME/goproject/{bin,src,pkg}➜ tonny@tonny-pc  ~  ll $HOME/goproject

Configuring Environment variables

➜ tonny@tonny-pc  ~  vi $HOME/.bashrcexport GOROOT=/usr/local/goexport GOPATH=$HOME/golangexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin➜ tonny@tonny-pc  ~  source $HOME/.bashrc

Check

➜ tonny@tonny-pc  ~ go versiongo version go1.6.3 linux/amd64➜ tonny@tonny-pc  ~ go envGOARCH="amd64"GOBIN=""GOEXE=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOOS="linux"GOPATH="/home/tonny/golang"GORACE=""GOROOT="/usr/local/go"GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"GO15VENDOREXPERIMENT="1"CC="gcc"GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"CXX="g++"CGO_ENABLED="1"

Installing Sublime Text3

Download the installation package from HTTP://WWW.SUBLIMETEXT.COM/3 and install it.

Install the package Control to Sublime Text 3

Open Sublime Text 3, press Ctrl + ' (back quote, Tab key above), enter the following and return to:

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())

Restart Sublime Text 3 after the installation is complete.

Installing Gosublime and Sidebarenhancements

Open Sublime Text 3, press Ctrl + Shift + P, in the popup window enter PCIP carriage return, at this time Sublime Text 3 will search through the network installable package information, wait a moment, will pop up the package list, enter Gosublime return, wait for Go Sublime installation is complete. After installation, you may be prompted Goroot Gopath is not set, regardless of it, and so on will be set (this and the system environment variables set in the Gopath goroot irrelevant).
Press Ctrl + Shift + P again, enter PCIP carriage return in the popup window, wait a moment, will pop up the package list, enter sidebarenhancements return, wait for sidebarenhancements to install.

Setting Gopath and Goroot in sublime Text 3

Open Sublime Text 3, menu "Preferences, Package Settings, Gosublime, Settings-default", open gosublime configuration To modify the Env settings information:
{
...//omitted
"env": {
"Goroot": "/usr/local/go",
"Gopath": "~/golang"
},
...//omitted
}
Setup is complete to restart Sublime Text 3.

All setup Completed

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

Press Ctrl + B to open the Compile window and enter go run./main.go to run the current file.

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.