This is a creation in Article, where the information may have evolved or changed.
Reprint: Golang/go language/go ide/go Windows environment build/go automatic prompt compiler/gosublime
Go is a compiled, hair-style, and garbage-collected programming language developed by Google.
Robert Greysmore (Robert griesemer), Rob Paik (Rob Pike) and Ken Thompson began designing the Go language in September 2007, and the Go language was developed based on the Inferno operating system. The go language was officially launched in November 2009 and implemented on Linux and Mac OS x platforms.
Go language mascot, very cute bar.
The Go language Hello world! Code:
[Java]View Plaincopyprint?
- Package Main
- Import "FMT"
- Func Main () {
- Fmt. Println ("Hello, World")
- }
Next comes the installation of the go development environment for everyone.
The first is to install Go, here is a detailed installation instructions, Http://code.google.com/p/golang-china/wiki/Install or Http://golang.org/doc/install
Below we install under window, Google has to provide win installation package, for beginners or very simple!
Https://code.google.com/p/go/downloads/list
Direct next .... Installation is very simple!
After installing the go, we can build the development environment , here I use Sublime Text 2 + gosublime + Gocode. For those who do not know sublime Text 2, you can look at the official website: http://www.sublimetext.com/(generally a lightweight, handy tool)
1. Download Sublime Text 2, address as follows: http://www.sublimetext.com/
2. After the decompression, double-click Sublime_text, you can use sublime text 2.
3. Install the package Control, after opening Sublime Text 2, press the shortcut key Ctrl + ', open the Command window line,' this button on the TAB key above, I just started not found, hehe. Enter the following and return to:
Import Urllib2,os; Pf= ' Package control.sublime-package '; Ipp=sublime.installed_packages_path (); Os.makedirs (IPP) if not os.path.exists (IPP) else None; 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 '
4. After restarting Sublime Text 2, it is possible to find a menu item in the Preferences menus under the package Control.
5. Now that the Gosublime plugin is installed, press and hold ctrl+shilft+p a dialog box will pop up.
Enter the Install Enter dialog box to pop up an installation package
If enter gosublime Select Gosublime Enter
Enter go build to select Enter (this is optional)
Done, Gosublime installed successfully.
6. Install Gocodebelow,
Open the console and enter the following:
Go get github.com/nsf/gocode
Go install github.com/nsf/gocode
You can also go to GitHub to download https://github.com/nsf/gocode.git (to install Google's git version management tool)
After the installation is complete, we can find an extra Gocode file in the Go/bin directory. (Be sure to put it in the bin directory)
7. Modify the Gosublime configuration: Under the Preferences menu, locate the package Settings, find the gosublime, and then find Settings-default. Re-open the file, add the following configuration, and save:
Well, so far, the development environment has been built.
Open Sublime Text 2 , create a new helloworld.go, and write the following code:
The time to witness the Go Code auto prompt
Enter a P
Carriage return (enter key)
The main method, the package is automatically generated for you.
Here is an example of printing:
Press the shortcut key ctrl + b interface:
Enter Go build hello.go
Run, also press the shortcut key ctrl + b interface below will appear the following interface, enter the Hello return.
well, by now, the development environment has been set up, I hope you will also learn the language of go.