This is a creation in Article, where the information may have evolved or changed.
- Download and install Go
- If you downloaded the MSI, install it directly by default, and continue to the next step until you finish
- Configuration: I do not need to configure the system variables when installing, the installation time has been modified, if not in the environment variables; C:\Go\bin, add it up (note there is a semicolon)
- After installation, download sublime 2:HTTP://WWW.SUBLIMETEXT.COM/2
- Open Sublime, press CTRL + ', will pop up a command line, the following this paragraph copy into,
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 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()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
press ENTER;
- Then restart Sublime.
- Download: Packagecontrol.sublime-package: https://sublime.wbond.net/Package%20Control.sublime-package
- Put the downloaded file in sublime Text 2\packages\package Control
- Tools->build system->new Build system, insert the following content
{ "cmd": ["Go", "Run", "$file _name"], "File_regex": "^[]*file \" (... *) \ ", line ([0-9]*)", "Working_dir": "$file _path", "selector": "Source.go"}
- Save.
- Restart Sublime, create a new test.go, write the following code
Package Mainimport "FMT" Func Main () { fmt. Printf ("Hello, world\n")}
- CTRL + B, compile.
- Ok