Open the Golang Tour

Source: Internet
Author: User
Tags sublime text learn golang gocode

If you are interested in Golang but have not yet begun to get started, this article is for you.

Why do you learn Golang?

Many of the articles lobbying developers to try Golang. For example, a speech by Golang's main designer, a German spat, a preface to a book by a domestic Golang preacher. I do not want to repeat Daniel's point of view, just to talk about their simple feelings.

Before I studied Golang, I was a fan of Java, like most users of Iteye. Yes, I like Java, open source, Cross-platform, powerful IDE support, and most importantly-lots of job opportunities.

But at the same time I hate Java. The bloated and indispensable IDE always gives me the urge to escape. Language lack of expression makes me feel like a long-winded aunt. The cumbersome configuration makes me want to puke when I see an XML file.

Later came into contact with Golang, only to discover that most of my imagination in the programming language was realized in Golang:

1. Without the need for IDE support, you can configure a perfect editing environment with simple steps.

2. Both dynamic language development efficiency and static language operating efficiency. Some people say that Golang is a combination of C and Python, which is very aptly described.

3. Stay away from XML.

4. Natural affinity with the *nix system.

5. Enjoy the fun of growing up, progressing and maturing with the language.

Now I write Java code in the company during the day, while the amateur learning time is all Golang.

Installation and Environment configuration

Click to download the Golang installation package, if the link is not accessible (good wonderful wall), please try to:

173.194.71.141 golang.org

Join the Hosts file.

The environment variables that need to be configured are (for example, Linux): SH code export goroot= $HOME/go # Go installation directory export path= $PATH: $GOROOT/bin # will install the BI of the directory N folder join path variable export gopath=~/dropbox/source/go # Gopath store personal source

Enter the go version at the command line to verify that everything is going well.

Editor

It is highly recommended that you build a Golang editing environment using sublime Text 2 + gosublime + Gocode + Margo.

Where Gosublime is a sublime Text 2 plug-in, and Gocode and Margo for the Gosublime to provide code automatically complement the strict function.

For an introduction to sublime Text 2, please refer to here.

Recommended reasons:

Supports all platforms.

Sublime Text 2 Interface refreshing, very fast response, very comfortable to use. Does not give people the feeling of being bloated like the IDE.

Installation steps:

1. Download and install Sublime Text 2.

2. Install package control, used to manage ST2 plug-ins.   Open Sublime Text 2, press ctrl+~, and enter the following command into the console: Python code import Urllib2,os;   pf= ' Package control.sublime-package ';   Ipp=sublime.installed_packages_path ();   Os.makedirs (IPP) if not os.path.exists (IPP) else None; Open (Os.path.join (IPP,PF), ' WB '). Write (Urllib2.urlopen (' http://sublime.wbond.net/' +pf.replace ('), '%20 '). Read () )

3. Restart ST2, if you see the Package control instructions in the Preferece-package settings, the installation is successful.

4. Install the Gosublime plug-in via package control. Press CTRL+SHIFT+P, enter install and return. After waiting for the response, enter gosublime and select Install.

5. In the Bash/dos command line, enter:

Go get-u github.com/nsf/gocode

Go get-u Github.com/disposaboy/margo

Go Install Github.com/nsf/gocode

Go Install Github.com/disposaboy/margo

After installing Gocode and Margo, switch to the $gopath/bin directory and run./margo.

At this point, edit the Environment configuration complete, click to see the final interface.

Document

You can either access Golang.org/doc directly, or you can enter at the command line:

godoc-http=:8080

To access the local mirror after:

localhost:8080

Getting Started Books

At the beginning, it is recommended to study the A-tour-of-golang on the official website.

Next, Learning-go is a good open source book, its Chinese version by xingxing translation and maintenance, translation quality is very good.

It is also possible to consider the recently published <<go language programming >>, the author of which is a pioneer in the domestic use of Golang to write large programs.

Students interested in the Web can pay attention to network programs with the go, went Web programming, and so on.

Community

It is recommended to add Golang-china mailing list, the community is very active, the daily discussion mail is basically more than 50. Of course, English good students can choose Golang-nuts.

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.