|
Golang / Go Languages / Go IDE / Go Windows environment to build / Go automatically prompts the compiler / GoSublime.
Go is a compiled developed by Google, and hair, and having garbage collection programming language.
Robert Geruishimo (Robert Griesemer), Rob Pike (Rob Pike) and Ken Thompson in September 2007 began to design language Go, Go language is based on the Inferno operating system development. Go language in November 2009 officially announced, and implemented on the Linux and Mac OS X platforms.
GO language mascot, very cute.
hello Go Language world! Code:
package main
import "fmt"
func main () {
fmt.Println ( "Hello, World")
}
Next, bring the installation Go development environment.
The first is the installation of Go, there is a very detailed installation instructions, http: //code.google.com/p/golang-china/wiki/Install or http://golang.org/doc/install
Here below our window installation, google has provided win packages for the novice or very simple!
https://code.google.com/p/go/downloads/list
Direct the next step ....... installation is very simple!
After installing Go, we can build a development environment, and here I use Sublime Text 2 + GoSublime + gocode. Friends do not understand the Sublime Text 2, you can see the official website: http: //www.sublimetext.com/ (in general is a lightweight, very convenient to use tools)
1. Download Sublime Text 2, at the following address: http: //www.sublimetext.com/
2. After extracting, double sublime_text, you can use Sublime Text 2 a.
3. Install Package Control, open Sublime Text 2 after press the shortcut keys Ctrl + `, open a command line window,` the key above Tab key, I just started not found, huh, huh. Enter the following and press Enter:
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 'Please restart Sublime Text to finish installation'
4. Restart Sublime Text 2, can be found in the Preferences menu, one more menu item Package Control.
5. Now install GoSublime plug-in, hold down Ctrl + Shilft + p will pop up a dialog box
Enter Enter install a pop-up dialog box installation package
As the GoSublime select Enter GoSublime
Enter Select Enter Go build (this is optional)
Get, GoSublime successful installation.
6. Install the following gocode,
Open the console, enter the following:
go get github.com/nsf/gocode
go install github.com/nsf/gocode
You can also go to github download https://github.com/nsf/gocode.git (To install the google git version management tool)
After installation is complete, we can at go / bin directory, find more of a gocode file. (Must be placed in the bin directory)
7. Modify GoSublime configuration: In the Preferences menu, locate the Package Settings, then find GoSublime, then down to find Settings - Default. Then open the file, add the following configuration and save
Well, so far, to build a complete development environment.
Open Sublime Text 2, New helloworld.go, write code as follows:
Go to witness the code automatically prompts the moment
Enter a p
Carriage return (enter key)
main methods, including automatically generated for you.
Here is an example of printing:
Keyboard shortcut Ctrl + b below the screen will appear the following interface:
Enter go build hello.go
Run, also press the shortcut keys Ctrl + b below the screen will appear the following screen, enter hello Enter.
Well, until now, development environment set up is completed, I hope everyone to learn Go language. |
|
|
|