Using Vscode to build Golang integrated development environment under MAC

Source: Internet
Author: User
Tags install go
This is a creation in Article, where the information may have evolved or changed.

The new company uses Golang as the main development language, and the development environment is a Mac, it is a big challenge for me, for the first time in my life, I used a Mac system, and the other one doesn't have a good IDE like vs in Mac, and now I find the greatness of Microsoft.

For an IDE I have two basic needs, the first need to be able to syntax recognition highlighting auto-complete jump, the second is to be able to debug. Only Vscode can support these two functions perfectly.
The company's started handbook recommended editor is Intelij, which is a very good editor and has always liked to study new things for me and began to engage. First I set up the go development environment locally and can build a Hello world in a command-line fashion. Then install Intelij, the Internet Google method, install go plugin, after installation do not know how to compile, and no one to teach, asked the next colleague, we use Intelij is only an editing tool, and did not use it to do debug, this can not meet my needs, so I gave up. Back to the previous used sublime, in Windows, Sublime3 is not support debug, Google came out of the article is the use of sublime2, but with sublime write go must use a plug-in gosublime, It only supports Sublime3, but gdbsublime only support sublime2, no fruit, with sublime3 combined with Gosublime to write, compile and run the Go program is not a problem is also very convenient, but if you want to use it to debug, do not, So I can only expect GDB plugin to be compatible with Sublime3 as soon as possible. Originally to this time should give up, remember colleague once said now many people began vscode to write go, the Internet casually Baidu, as if it can meet my two basic needs.

Back with vs still very cordial, after all, after doing so many years of VS development. Install the Vscode, use the shortcut key command+shift+p Enter command mode, check the installation extensions

After installing the console installation tool

go get -u -v github.com/nsf/gocodego get -u -v github.com/rogpeppe/godefgo get -u -v github.com/zmb3/gogetdocgo get -u -v github.com/golang/lint/golintgo get -u -v github.com/lukehoban/go-outlinego get -u -v sourcegraph.com/sqs/goreturnsgo get -u -v golang.org/x/tools/cmd/gorenamego get -u -v github.com/tpng/gopkgsgo get -u -v github.com/newhook/go-symbolsgo get -u -v golang.org/x/tools/cmd/gurugo get -u -v github.com/cweill/gotests/...

Install these tools to meet the first requirements of the edit installation run Go program, to be able to debug need to install another tool delve
Installation method See the link to find your own system to install the delve tool.

This time the entire Vscode integrated installation runs the debug environment just fine.
Command+o Open a src folder, in this folder to create a go file, write on Helloworld,mac is command+shift+d into debug mode, F12 is added breakpoint, which is not the same as Windows. The rest will be enjoyable to play.

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.