Go locale configuration Sublime Text + gosublime+ Gocode + Margo group

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

Bought "Go Web Programming" a book to learn go language, the results in accordance with the steps of the book to build, found that some sites have been invalidated, check the online a lot of tutorials and no one can say clearly how to build. Or do you find a way to do it, after their unremitting efforts finally set up. PS: No Google day is too uncomfortable, check the information of various inconvenient, usually basic not FQ, so ...

1. Download and install go, today installed go to find the Go official website can not open, on the Internet to find a variety of Go no fruit, but still inadvertently found a, I hope you see this article when you are able to download. My machine is a 64-bit windows8, it's too hard to find an available MSI. Attached address: Https://code.google.com/p/go/downloads/list?q=OpSys-Windows+Type%3DInstaller. My computer has changed the Google hosts, if you do not have access to this address, it is recommended that you do.
After the download of the installation is very simple, next to the end of the good, after the installation, open the terminal, enter go return, you can see the installation of the success of the prompt to show that the installation was successful.
2. Set Gopath, find a folder where you want to place the Go project, add a gopath environment variable, and point to this folder. If Gopath=c:\mygo. In general, create three subdirectories under Gopath, src,bin,pkg.
3. Once the preparation is complete, start building the sublime text development environment for the go language.
A. After downloading the installation sublime text, install the package Control (self-Find online tutorial, then how to install the plugin does not repeat).

B. Install Gocode and Margo. Before you do this, make sure you have Git installed. If not then please follow the steps below to install the Git feature (not all features, only to complete the construction of the environment, about the details of git, please refer to the GIT website). If you are already a git user, skip the steps below and go directly to step d.

C.msysgit is a git for Windows version with the home page: http://msysgit.github.io/click "Download" on the page to enter the download list. After downloading, double-click to start the installation: 1, except for the ADVANCEDXXX option, the remaining select all. 2. Select "Use Git Bash only". 3, select "Checkout as-is,commit as-is". 4, configure the GIT environment variable, appended to the path (copy the following code to change the installation path of git);D: \program Files\git\bin;d:\program Files\git\libexec\git-core;

D. Open the terminal and run the following command to install Gocode and Margo.
Go get Github.com/nsf/gocode Go get Github.com/disposaboy/margo (the tool has been emptied by the author and most people are stuck in this step) if you're stuck in the second step,   Then you can replace it in my own way. Use go get Github.com/slene/margo this instead. But this tool needs to be changed a little bit by itself. After performing this step, you can restart the next Sublimetext test, the following will output the installation error message, you will be prompted to find a file called Gosublime.margo_***.exe. At this time, you can go to your gopath under the bin directory to find margo.exe files, you can rename this file to just can't find the file name. Then copy it to the C:\users\**\appdata\roaming\sublime Text 3\packages\user\gosublime\windows-x64\bin below.

E. Install the Sublimetext plugin: Gosublime, sidebarenhancements, and go buid. Modify the Gosublime configuration: Under the Preferences menu, locate the package Settings, find Gosublime, and then find Settings-default. Re-open the file, add the following configuration, and save: "env": {"path": "C:/go/bin;"},
OK, then you can write the go code to verify it.
If you use the Ctrl+b shortcut key to compile go, you can create a new build system yourself. Specific execution: Tools-build system-new Build system, then replace with: {"cmd": ["Go", "Run", "$file _name"], "File_regex": "^[]*file \" (... *?) \ ", line ([0-9]*)", "Working_dir": "$file _path", "selector": "Source.go"} on it, select the build system at compile time.

Go locale configuration Sublime Text + gosublime+ Gocode + Margo group

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.