Golang/go language/go ide/go Windows environment build/go automatic prompt compiler/gosublime

Source: Internet
Author: User
Tags install go sublime text gocode



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?
    1. Package Main
    2. Import "FMT"
    3. Func Main () {
    4. Fmt. Println ("Hello, World")
    5. }
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  package Control, after opening Sublime Text 2, press the shortcut key   Ctrl + ' , open the Command window line, "This button is on the TAB key, I haven't found it at first, 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 Gocode below,



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:





Pressing the shortcut key below the Ctrl + b interface will appear as follows:








Enter Go build hello.go





Run, also press the shortcut key   ctrl + b   interface, the following interface appears, input   Hello enter.





Well, by now, the development environment has been set up, I hope you will also learn the language of go.






Novice Entry Reference:



The starter API is the best new starter document I've ever seen and I want go to flourish.



Original link: http://blog.csdn.net/love_se/article/details/7754274



Golang/go language/go ide/go Windows environment build/go automatically prompt compiler/gosublime


Related Article

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.