Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: trying to marshal unsupported type map[K]V SA1026 #52467

Closed
OneOfOne opened this issue Apr 21, 2022 · 2 comments
Closed

x/tools/gopls: trying to marshal unsupported type map[K]V SA1026 #52467

OneOfOne opened this issue Apr 21, 2022 · 2 comments
Labels
gopls Tools
Milestone

Comments

@OneOfOne
Copy link
Contributor

@OneOfOne OneOfOne commented Apr 21, 2022

gopls version

❯ gopls -v version
Build info
----------
golang.org/x/tools/gopls master
    golang.org/x/tools/gopls@(devel)
    github.com/BurntSushi/toml@v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
    github.com/google/go-cmp@v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp/typeparams@v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM=
    golang.org/x/mod@v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
    golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
    golang.org/x/sys@v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
    golang.org/x/text@v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
    golang.org/x/tools@v0.1.11-0.20220330174940-8e193c2ba95e => ../
    golang.org/x/vuln@v0.0.0-20220324005316-18fd808f5c7f h1:9dMzk88fnONra7zrEalqkRMGa9jMGf9B5mdzhYVyI28=
    honnef.co/go/tools@v0.3.0 h1:2LdYUZ7CIxnYgskbUZfY7FPggmqnh6shBqfWa8Tn3XU=
    mvdan.cc/gofumpt@v0.3.0 h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: devel go1.19-b941a10e38 2022-04-21 16:18:44 +0000

go env

GO111MODULE="auto"
GOARCH="amd64"
GOBIN="/home/oneofone/code/go/bin"
GOCACHE="/home/oneofone/.cache/go-build"
GOENV="/home/oneofone/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/oneofone/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/oneofone/code/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/home/oneofone/sdk/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/home/oneofone/sdk/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.19-b941a10e38 2022-04-21 16:18:44 +0000"
GCCGO="gccgo"
GOAMD64="v3"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3049006607=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go.dev/play/p/YDN24ULS4iV

Called json.Marshal on a generic map.

What did you expect to see?

No lint error.

What did you see instead?

Lint error trying to marshal unsupported type map[K]V

Editor and settings

//"go.languageServerFlags": ["-rpc.trace"],
	"gopls": {
		"formatting.gofumpt": true,
		"ui.diagnostic.staticcheck": true,
		"ui.diagnostic.analyses": {
			"ST1000": false,
			"ST1003": false,
			"SA5001": false,
			"nilness": false,
			"unusedwrite": false,
			"unusedparams": false,
			// too much noise
			"fieldalignment": true,
			"shadow": false,
			"composites": true
		},
		"ui.codelenses": {
			"generate": true,
			"regenerate_cgo": true,
			"test": true,
			"vendor": true,
			"tidy": true,
			"upgrade_dependency": true,
			"gc_details": true
		},
		"ui.diagnostic.annotations": {
			"bounds": true,
			"inline": true,
			"escape": true,
			"nil": true
		},

		"ui.completion.usePlaceholders": false,
		"ui.navigation.importShortcut": "Definition",
		"ui.completion.completionBudget": "200ms",
		"ui.diagnostic.diagnosticsDelay": "100ms",

		"build.allowImplicitNetworkAccess": true,
		"build.directoryFilters": ["-node_modules", "-data"],

		"ui.completion.experimentalPostfixCompletions": true,
		"build.experimentalPackageCacheKey": true
	},
@gopherbot gopherbot added Tools gopls labels Apr 21, 2022
@gopherbot gopherbot added this to the Unreleased milestone Apr 21, 2022
@OneOfOne OneOfOne changed the title x/tools/gopls: trying to marshal unsupported type map[K]V x/tools/gopls: trying to marshal unsupported type map[K]V SA1026 Apr 21, 2022
@dominikh
Copy link
Member

@dominikh dominikh commented Apr 21, 2022

That's a Staticcheck analysis, and a bug in the same.

@findleyr
Copy link
Contributor

@findleyr findleyr commented Apr 22, 2022

Thanks @dominikh.

Closing this issue in favor of the upstream issue, which has been fixed. We'll pick this up with the next staticcheck release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Tools
Projects
None yet
Development

No branches or pull requests

4 participants