In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the method of vscode configuring golang environment". In the daily operation, I believe that many people have doubts about the method of vscode configuring golang environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "vscode configuration golang environment". Next, please follow the editor to study!
Go download
Https://studygolang.com/dl, domestic downloads, foreign ones are blocked, you know
Double-click the installation directly after the download is completed. The default installation directory is C:/Go
Enter cmd to open the command line tool while running, and enter go version at the prompt to display as follows:
1.2 configure gopath
Next, it's important to set up the go working directory gopath, where all future go projects are located. The settings under Windows are as follows. Create a new environment variable named GOPATH, and the value is your working directory. My setting: GOPATH=D:\ GoPath.
Create three folders under% GOPATH%:
The directory where src stores the source code, and where all the new projects are located.
The package files generated after pkg compilation are stored in the directory.
The executable files produced after bin compilation and go-related tools are all in this directory. Add this directory to the Path environment variable to facilitate the use of go.
View the golang environment variable settings through go env. As shown in the figure:
Install the go plug-in
Start vscode Select plug-in-> search go Select Go for Visual Studio Code plug-in and click install. As shown in the figure:
Click File menu-> Open folder, and select the configured gopath directory, as follows:
Several packages failed during installation, as shown in the figure:
3.3vscode automatic installation failed, perform manual installation
The first step is to open git bash in the% GOPATH%\ src\ golang.org\ x directory and execute git clone http://github.com/golang/tools. You must use git to clone, otherwise install other components such as go get-u-v github.com/cweill/gotests. Package golang.org/x/tools/imports:directory "D:\ GoPath\ src\ golang.org\ x\ tools\ imports" > after the second step tools is downloaded, go to the% GOPATH%\ src\ golang.org\ x\ tools\ cmd\ gorename directory, right-click shift+ and select to open the command window here, and execute go install,guru to do the same.
The third step is to execute go get-u-v github.com/newhook/go-symbols in the command line window to install go-symbols. Several others do the same, see the package link.
If there is a package golang.org/x/tools/go/buildutil: cannot download, http://github.com/golang/tools uses insecure protocol error, it is not difficult to see that downloading tools is the cause. Since we have already installed tools above and goo-symbols has passed through go get, we go directly to the% GOPATH%\ src\ github.com\ newhook\ go-symbols directory and go to the command line to execute go install. The successful installation of go-symbols.exe appears in the% GOPATH%\ bin directory.
Error pkg\ proc\ disasm.go:9:14: undefined: ArchInst, installation failed because dlv only supports x64-bit go.
3.4 the link to the installation package is as follows:
Go get-u-v github.com/bytbox/golint
Go get-u-v github.com/golang/tools
Go get-u-v github.com/lukehoban/go-outline
Go get-u-v github.com/newhook/go-symbols
Go get-u-v github.com/josharian/impl
Go get-u-v github.com/sqs/goreturns
Go get-u-v github.com/cweill/gotests
At this point, the study of "vscode's method of configuring the golang environment" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.