我的vscode-go的settings.json文件
支持go module
平时开发使用vscode的时候,已经完全使用go module了。
如果你发现你的机器在go语言标准包提示消耗的时间很长,请
将GO111MODULE设为auto/off。
使
用
这
个
配
置
记
得
将
环
境
变
量
−
>
添
加
/
设
置
为
:
\color{red}{使用这个配置记得将环境变量->添加/设置为:}
使用这个配置记得将环境变量−>添加/设置为:
G
O
111
M
O
D
U
L
E
=
o
n
\color{#ff00ff}{GO111MODULE=on}
GO111MODULE=on
然
后
网
上
看
到
说
v
s
c
o
d
e
不
支
持
\color{#ff0000}{然后网上看到说vscode不支持}
然后网上看到说vscode不支持
第
三
方
包
/
自
定
义
包
的
包
函
数
/
变
量
等
内
容
的
自
动
提
示
/
完
成
。
\color{#ff0000}{第三方包/自定义包的包函数/变量等内容的自动提示/完成。}
第三方包/自定义包的包函数/变量等内容的自动提示/完成。
.
.
我
能
说
我
的
不
会
遇
到
这
个
问
题
吗
?
a
n
y
w
a
y
,
现
在
配
置
好
后
,
\color{#ff00ff}{.. 我能说我的不会遇到这个问题吗?anyway,现在配置好后,}
..我能说我的不会遇到这个问题吗?anyway,现在配置好后,
使
用
g
o
.
m
o
d
了
,
没
有
遇
到
这
个
问
题
了
。
记
得
项
目
目
录
下
,
g
o
m
o
d
i
n
i
t
一
下
。
\color{#ff00ff}{使用go.mod了,没有遇到这个问题了。记得项目目录下,go mod init 一下。}
使用go.mod了,没有遇到这个问题了。记得项目目录下,gomodinit一下。

{
"go.goroot": "D:\\go",
"go.gopath": "D:\\go_project",
"go.inferGopath": false,
"go.toolsGopath": "D:\\go_project",
"window.zoomLevel": 0,
"git.autofetch": true,
"terminal.integrated.shell.windows": "powershell.exe", // 也可以使用 cmd.exe
// "terminal.integrated.shellArgs.windows": [
// "/k",
// "D:\\Applications\\Cmder\\Cmder.exe"
// ],
"workbench.colorTheme": "Monokai Pro (Filter Machine)",
"workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
"editor.renderControlCharacters": false,
"editor.snippetSuggestions": "top",
"editor.suggest.snippetsPreventQuickSuggestions": true,
"breadcrumbs.enabled": true,
"terminal.explorerKind": "external",
"editor.cursorStyle": "block",
"editor.links": false,
"editor.mouseWheelZoom": true,
"editor.renderLineHighlight": "all",
"editor.suggest.shareSuggestSelections": true,
"outline.icons": true,
"search.showLineNumbers": true,
"search.smartCase": true,
// package 查找模式
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeGoroot": true,
"go.gotoSymbol.includeImports": true,
// build 相关
"go.buildOnSave": "off",
"go.gocodeAutoBuild": true,
"go.installDependenciesWhenBuilding": true,
"go.buildFlags": [],
"go.buildTags": "",
"go.coverOnSingleTest": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "guru",
"go.formatTool": "goimports",
"go.lintTool": "golangci-lint",
"go.lintOnSave": "package",
"go.lintFlags": [
"--fast"
],
"go.formatFlags": [],
"go.vetFlags": [],
"go.vetOnSave": "package",
"go.generateTestsFlags": [],
"go.liveErrors": {
"enabled": true,
"delay": 500
},
"go.gocodeFlags": [
"-builtin",
"-ignore-case",
"-unimported-packages"
],
"go.enableCodeLens": {
"references": true,
"runtest": true
},
"go.delveConfig": {
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 1,
"maxStringLen": 64,
"maxArrayValues": 64,
"maxStructFields": -1
},
"apiVersion": 2,
"showGlobalVariables": true
},
"go.editorContextMenuCommands": {
"toggleTestFile": true,
"addTags": true,
"removeTags": true,
"testAtCursor": true,
"testFile": true,
"testPackage": true,
"generateTestForFunction": true,
"generateTestForFile": true,
"generateTestForPackage": true,
"addImport": true,
"testCoverage": true,
"playground": true,
"debugTestAtCursor": true
},
"go.playground": {
"openbrowser": false,
"share": false,
"run": false
},
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": true,
"transform": "snakecase"
},
"go.removeTags": {
"tags": "",
"options": "",
"promptForTags": false
},
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
"go.alternateTools": {
"go-langserver": "gopls",
},
"go.useLanguageServer": false,
"go.languageServerFlags": [],
"go.languageServerExperimentalFeatures": {
"format": true,
"autoComplete": true,
"rename": true,
"goToDefinition": true,
"hover": true,
"signatureHelp": true,
"goToTypeDefinition": true,
"goToImplementation": true,
"documentSymbols": true,
"workspaceSymbols": true,
"findReferences": true,
"diagnostics": false
}
}