Start a tour of golang

Source: Internet
Author: User
Tags gocode

If you are interested in golang but haven't started to get started, this article is for you.

 

 

Why Learning golang?

Many articles have been made by developers to try golang. for example, the speech of golang's main designers, the speech of a German, and the preface of the book by golang evangelists in China. I don't want to repeat the views of the Titans, but I just want to talk about my plain feelings.

Before learning golang, I was a Java enthusiast, just like most iteye users. yes. I like Java, open-source, cross-platform, and powerful ide support. The most important thing is that there are many job opportunities.

But I also hate Java. the bloated and indispensable ide always gives me the impulse to escape. the lack of Expressiveness makes me feel awkward. the complicated configuration made me want to vomit when I saw the XML file.

Later I came into contact with golang and found that most of my imagination about programming languages was implemented by golang:

1. Ide support is not required. You only need to perform simple steps to configure the perfect editing environment.

2. Both the development efficiency of Dynamic Language and the running efficiency of static language. Some people say golang is a combination of C and python, which is a very apt description.

3. Stay away from XML.

4. natural affinity with * nix systems.

5. enjoy the fun of growing, making progress, and maturity together with the language.

Now I write Java code in my company during the day, while golang is all used in my spare time.

 

 

Installation and environment Configuration

Click to download the golang installation package. If the link cannot be accessed (the wonderful wall), try:

173.194.71.141 golang.org

Add the hosts file.

The environment variables to be configured include ):

Sh code
  1. Export goroot = $ home/go # Go installation directory
  2. Export Path = $ path: $ goroot/bin # Add the bin folder in the installation directory to the PATH variable
  3. Export gopath = ~ /Dropbox/source/go # store the personal source code under gopath

Enter go version in the command line to verify the operation.

 

 

Editor

We strongly recommend that you use sublime text 2 + gosublime + gocode + Margo to build the golang editing environment.

Gosublime is a plug-in of sublime text 2, while gocode and Margo provide code auto-completion and other functions for gosublime.

For more information about sublime text 2, see here.

Recommendation reason:

All platforms are supported.

The sublime text 2 interface is refreshing, extremely responsive, and very comfortable to use. It will not feel as bloated as IDE.

Installation steps:

1. Download and install sublime text 2.

2. install package control to manage the st2 plug-in. Open sublime text 2, press Ctrl + ~, Enter the following command in the console:

Python code
  1. Import urllib2, OS;
  2. PF = 'package control. sublime-package ';
  3. IPP = sublime. installed_packages_path ();
  4. OS. makedirs (IPP) if not OS. Path. exists (IPP) else none;
  5. Open (OS. path. join (iPP, PF), 'wb '). write (urllib2.urlopen ('HTTP: // sublime.wbond.net/'{pf.replace ('', '% 20 ')). read ())

3. Restart st2. If you see package control in preferece-package settings, the installation is successful.

4. Install the gosublime plug-in through package control. Press Ctrl + Shift + P, enter install, and press Enter. wait for a response, enter gosublime, and select install.

5. input the following in the bash/doscommand line:

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.

Now, the Environment configuration is complete. Click to view the final page.

 

 

Document

You can directly access golang.org/doc or enter the following in the command line:

Godoc-HTTP =: 8080

Then access the local image:

Localhost: 8080

 

 

Getting started books

At the beginning, we recommend that you learn about a-tour-of-golang on the official website.

Next, learning-go is a good open-source book. Its Chinese version is translated and maintained by Xingxing, and the translation quality is very good.

You can also consider the recently published <go language programming>. The author of this book is a pioneer in writing large programs using golang in China.

If you are interested in the Web, you can follow network program with go and go web programming.

 

 

Community

We recommend that you add the golang-China email list. This community is very active and there are more than 50 discussion emails every day. Of course, if you are good at English, you can select 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.