In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the solutions that cannot be installed in the go language vscode. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
What if the go language vscode cannot be installed?
Installation and configuration of Go language-vscode
If you want to start the development of the go language, but haven't taken the first step yet, this article should get you started quickly and take fewer detours.
Recommended for related tutorials: vscode tutorial
Note: this article is based on the windows operating system, the editor uses vscode, and the language is as brief as possible.
Before you begin, you need to know how to configure the environment variables of the windows system, which is relatively simple, so I won't repeat it here.
Installation steps
Go download address: https://golang.google.cn/
Vscode download address: https://code.visualstudio.com/Download
Go and vscode installation steps: choose the path and go all the way to the end. (this article go is installed at c:\ Go)
Matters needing attention
After a successful installation, there will be some changes in the environment variables:
Add the bin directory of the Go installation directory to path to execute the go command.
GOROOT is newly added to the environment variable, and the default value is the installation directory (mine is c:\ Go)
GOPATH is newly added to the environment variable, and my default value is C:\ Users\ Administrator\ go. You can set this directory manually, and you can set multiple values to store the packages and commands downloaded by go. The subsequent packages you write should also be placed in the directory specified by GOPATH.
Normally, the above environment variables are set automatically after go is installed, and it is possible to modify them manually if they are not set automatically.
After the installation is complete, open the command line and enter go version. If you are prompted for the version of go, the installation is successful.
Vscode Settin
Open vscode, create a new file with the suffix go, vscode will automatically prompt to install the Go plug-in, directly install you can see the Go highlighted.
Then we can write our "hello world" program.
Package main import "fmt" func main () {fmt.Println ("Hello world")}
Fill the pit
When we write go programs in vscode, we will be prompted to download some packages, but these packages cannot be downloaded directly for some well-known reasons, we need to download them manually, and the steps are very simple (again, we have to download and install Git, and add the git command to the environment variable. ).
Open the directory corresponding to GOPATH. Mine is C:\ Users\ Administrator\ go. There will be a src directory (there may also be bin and pkg directories) to create a new directory in src. The structure is as follows (if you already have, you do not need to create a new directory, you will complete what you do not have):
Github.comgolanggolang.orgx
After the directory is created successfully, execute it in the x directory
Git clone https://github.com/golang/tools.git tools
Then copy a copy of the downloaded tools directory to the golang directory, and the directory structure changes to:
Github.comgolangtoolsgolang.orgxtools
At this point, when the vscode installation prompt appears again, we click install, and the installation will be successful.
However, if the installation is still not successful, we can also install it manually and execute the following commands respectively.
Go install github.com/ramya-rao-a/go-outline go install github.com/acroca/go-symbols go install golang.org/x/tools/cmd/guru go install golang.org/x/tools/cmd/gorename go install github.com/josharian/impl go install github.com/rogpeppe/godef go install github.com/sqs/goreturns go install github.com/golang/lint/golint go install github.com/cweill/gotests/gotests
Code hints for vscode
Now, we have successfully installed the package prompted by vscode, but there is still a small problem. Vscode does not have the code hint for go. We just need to simply configure vscode. The configuration code is as follows (settings.json):
{"go.autocompleteUnimportedPackages": true, "go.gocodePackageLookupMode": "go", "go.gotoSymbol.includeImports": true, "go.useCodeSnippetsOnFunctionSuggest": true, "go.inferGopath": true, "go.gopath": "C:/Users/Administrator/go", "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,} about "Solutions that go language vscode cannot install" ends here. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
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.