In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 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 how to run the edited go language code in 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.
The vscode-go plug-in is required for vscode to run go language code. Then use keyboard shortcuts such as F5 (continue), F10 (step over), F11 (step into) to run the go language code.
Install the vscode-go plug-in
Enter the vscode interface, open the command panel Ctrl + Shift + P, and enter install
Plug-in features include:
Completion Lists (using gocode) Signature Help (using godoc) SnippetsQuick Info (using godef) Goto Definition (using godef) Find References (using guru) File outline (using go-outline) Workspace symbol search (using go-symbols) Rename (using gorename) Build-on-save (using go build and gotest) Lint-on-save (using golint or gometalinter) Format (using goreturns or goimports or gofmt) Generate unit tests squeleton (using gotests) Add Imports (using gopkgs) [partially implemented] Debugging
Visual Studio Code Go plug-in configuration options
After starting vscode, select File menu-> preferences-> Workspace Settings
In the open .vscode / settings.json file, modify goroot and gopath
{/ / Go configuration / / Run'go build'/'go test-c'on save. "go.buildOnSave": true, / / Flags to `go build` / `go test` used during build-on-save or running tests. (e.g. ['- ldflags= "- s"']) "go.buildFlags": [], / / Run Lint tool on save. Go.lintOnSave: true, / / Specifies Lint tool name. "go.lintTool": "golint", / / Flags to pass to Lint tool (e.g. ['- min_confidenc=.8']) "go.lintFlags": [], / / Run'go tool vet' on save. "go.vetOnSave": true, / / Flags to pass to `go tool Vet` (e.g. ['- all','- shadow']) "go.vetFlags": [], / / Pick 'gofmt',' goimports' or 'goreturns' to run on format. "go.formatTool": "goreturns", / / Flags to pass to format tool (e.g. [- s']) "go.formatFlags": [], / Run the formatting tools with the-d flag "go.useDiffForFormatting": true, / / Complete functions with their parameter signature "go.useCodeSnippetsOnFunctionSuggest": false, / / Specifies the GOPATH to use when no environment variable is set. Go.gopath: "/ / home/chenjianhua/gocode", / / Specifies the GOROOT to use when no environment variable is set. "go.goroot": "/ usr/local/go", / / Run formatting tool on save "go.formatOnSave": true, / / Run'go test-coverprofile' on save "go.coverOnSave": false, / / Specifies the timeout for go test in ParseDuration format. "go.testTimeout": "30s", / / Enable gocode's autobuild feature "go.gocodeAutoBuild": true, / / The Go build tags to use for all commands that support a `- tags'... '`argument "go.buildTags": ", / / Environment variables that will passed to the process that runs the Go tests" go.testEnvVars ": {}, / / Autocomplete members from unimported packages. "go.autocompleteUnimportedPackages": true}
Vscode editor shortcut key
Command panel Ctrl + Shift + P or F1
Go to file Ctrl + P
Switch terminal Ctrl + `
Rename F2
Debug F5 (continue) F10 (step over) F11 (step into)
Jump to the next place with error or warning, F8.
Jump to the place defined by function F12
Zoom the entire screen Cmd + / Ctrl +
This is the end of the article on "how to run the edited go code in vscode". I hope 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.