go mod init baseline_server
go mod tidy
go env
settings.json
{
"go.goroot": "/home/test/go",
"go.gopath": "/home/test/gopath",
//第三方库代码提示
"go.inferGopath": false,
"go.formatTool": "goreturns",
//自动完成未导入的包
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.docsTool": "gogetdoc",
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
}, // Optional: Disable snippets, as they conflict with completion ranking. "editor.snippetSuggestions": "none",
},"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},"go.trace.server": "verbose",
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": false,
// If true, enable additional analyses with staticcheck.
// Warning: This will significantly increase memory usage. "staticcheck": false,
},"go.languageServerFlags": [
"-remote=auto", "-logfile=auto", "-debug=:0", "-rpc.trace",
],
}
How to Debug Golang with VS Code | VS Code debug specs - Go
pls: Get "https://proxy.golang.org/golang.org/x/tools/gopls/@v/list": dial tcp 142.251.42.241:443: connect: connection refused
解决go包管理代理网址无法访问:proxy.golang.org - 好极了 - 博客园
go env -w GOPROXY=https://goproxy.cn