vs Code Golang Plugin record

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

First of all, two URLs are recommended:

Relatively good blog: http://www.cnblogs.com/zsy/p/5223957.html

when downloading the code, the Golang.org/x/tools code cannot be downloaded and can be resolved using Http://www.golangtc.com/download/package


===========================================================

1, the following several because do not rely on golang.org/x/tools, so can download normal

Go get-u-v github.com/nsf/gocode

Go get-u-v github.com/rogpeppe/godef

Go get-u-v github.com/lukehoban/go-find-references

Go get-u-v githbu.com/tpng/gopkgs

After the download is complete, the executable file can be generated normally under Gobin

Gocode.exe

Godef.exe

Go-find-references.exe

Gopkgs.exe


2. If you want to download golang.org/x/tools from GitHub, you can do it on git

Go get-u-v github.com/golang/tools

After the download is successful, cut the tools into the src/golang.org/x directory


3. Execute in git

Go get-u-v github.com/golang/lint/golint

During execution, you will be prompted

HTTPS fetch Failed:get Https://golang.org/x/tools/go/gcimporter15?go-get=1:net/http:TLS handshake timeout

Do not ignore it, after successful execution will be generated under Gobin Golint.exe

Similarly:

Go get-u-v github.com/lukehoban/go-outline

Go get-u-v github.com/newhook/go-symbols


4. If you want to download sourcegraph.com/sqs/goreturns from GitHub, you can do it on git

Go get-u-v github.com/sqs/goreturns

After the download is successful, cut the sqs/goreturns into the src/sourcegraph.com/directory and execute

Go get-u-v sourcegraph.com/sqs/goreturns

Go get-u-v golang.org/x/tools/cmd/gorename


There are several EXE files under the Gobin path at this point:

Gorename

Goreturns

Go-symbols

Go-outline

Golint

gopkgs

Go-find-references

Gocode

Godef


5. Then make a configuration

Files > Preferences > User settings

{

Listen to "Files.autosave": "Onfocuschange",

Listen to "Go.goroot": "D:/go",

Listen to "Go.gopath": "D:/go/bin",

Listen to "Go.formattool": "Goreturns"

}

At this time, write the code is Cool crooked:)


6, and then the egg, debugging no birds, because less dlv.exe, on Git to execute the following command

Go get-v-u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv

After a long wait, will generate Dlv.exe under the Gobin


7, write a demo to debug it

Create the Src\omgs directory under the Gopath path, create the Demo.go file under OMGs, write the code and then make a breakpoint, F5 debug, everything is very sour.


===========================================================

Be a loving person:

1, if you encounter problems in the process of building the environment can be at any time to communicate with me, may be able to record this chapter video;

2, for the convenience of lazy people, I would like to upload the generated exe to 51CTO Download Center , but because the file is relatively large, you need to contact me directly;

Please call me Lei Feng ~


This article from "Green Guest" blog, declined reprint!

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.