Jim*_*imi 26 go visual-studio-code go-packages
我正在 GoPath 中编写一个 Go 项目,并且我正在使用 Redigo 包连接到 Redis 服务器。应用程序运行良好,但是在 VSCode 中,包导入时出现了这个烦人的错误,这阻止了 VSCode 提供智能感知建议
无法导入 github.com/gomodule/redigo/redis(没有导入路径 github.com/gomodule/redigo/redis 的包数据)
这是我的 VSCode settings.json
{
"editor.fontSize": 14,
"editor.formatOnPaste": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"extensions.ignoreRecommendations": false,
"workbench.statusBar.visible": true,
"workbench.iconTheme": "vscode-great-icons",
"files.autoSave": "afterDelay",
"go.useLanguageServer": true,
"go.alternateTools": {
"go-langserver": "bingo"
},
"go.toolsEnvVars": {
"GO111MODULE": "on"
},
"go.languageServerExperimentalFeatures": {
"autoComplete": true,
"documentSymbols": true,
"findReferences": true,
"format": true,
"goToDefinition": true,
"goToTypeDefinition": true,
"hover": true,
"signatureHelp": true,
"rename": true,
"workspaceSymbols": true,
},
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast",
"-E", "goimports",
"-E", "gocritic",
"-E", "gocyclo",
"-E", "gosec",
"-E", "maligned",
"-E", "scopelint",
"-E", "interfacer",
"-E", "goconst",
"-E", "unconvert",
"-E", "unparam",
"-E", "prealloc",
"-E", "varcheck",
],
"go.formatTool": "goimports",
"editor.minimap.enabled": false,
"breadcrumbs.enabled": false,
"git.autofetch": true,
"workbench.startupEditor": "newUntitledFile",
"explorer.confirmDelete": false,
"git.enableSmartCommit": true,
"git.confirmSync": false,
"window.zoomLevel": 0,
"explorer.confirmDragAndDrop": false
}
go env
set GOARCH=amd64
set GOBIN=C:\Users\Francesco\Go\bin
set GOCACHE=C:\Users\Francesco\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Francesco\Go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\Francesco\Go\src\test\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\FRANCE~1\AppData\Local\Temp\go-build928398422=/tmp/go-build -gno-record-gcc-switches
我应该改变什么才能使这项工作?