Skip to content

x/tools/gopls: panic: unknown basic type, struct has unsafe.Pointer #52640

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

Closed
ii64 opened this issue May 1, 2022 · 2 comments
Closed

x/tools/gopls: panic: unknown basic type, struct has unsafe.Pointer #52640

ii64 opened this issue May 1, 2022 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@ii64
Copy link

ii64 commented May 1, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ii64/.cache/go-build"
GOENV="/home/ii64/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ii64/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ii64/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="/usr/local/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ii64/Workspace/Golang/ii64/unsafe-go/go.mod"
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-build3040284599=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Auto filling struct that has unsafe.Pointer

What did you expect to see?

Works as like another struct, ignoring the field that has type of unsafe.Pointer

What did you see instead?

panic: unknown basic type

goroutine 1325 [running]:
golang.org/x/tools/internal/lsp/analysis/fillstruct.populateValue(0xc00049512c?, 0x4?, 0x1592240?, {0x10535b8?, 0x153ff00?})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:372 +0xc74
golang.org/x/tools/internal/lsp/analysis/fillstruct.SuggestedFix(0xc0015f6000?, {0xc0002bfec0, 0x58099, 0x580a9, {0x10539c8, 0xc000943d30}}, {0xc000cf7200, 0x849, 0x900}, 0xc0002a3580, ...)
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:259 +0xf52
golang.org/x/tools/internal/lsp/source.singleFile.func1({0x1057048, 0xc0030a0200}, {0x105fb00, 0xc0003bcc60}, {0x105a2a0?, 0xc0009166c0}, {{0x4d, 0x37}, {0x4f, 0x2}})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/fix.go:59 +0x1ba
golang.org/x/tools/internal/lsp/source.ApplyFix({0x1057048, 0xc0030a0200}, {0xc00576f3e0, 0xb}, {0x105fb00?, 0xc0003bcc60?}, {0x105a2a0, 0xc0009166c0}, {{0x4d, 0x37}, ...})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/fix.go:78 +0xfd
golang.org/x/tools/internal/lsp.(*commandHandler).ApplyFix.func1({0x1057048, 0xc0030a0200}, {{0x105fb00, 0xc0003bcc60}, {0x105a2a0, 0xc0009166c0}, 0x0})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command.go:143 +0xb1
golang.org/x/tools/internal/lsp.(*commandHandler).run.func1()
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command.go:108 +0x89
golang.org/x/tools/internal/lsp.(*commandHandler).run(0xc002af41c0, {0x1057048, 0xc003092d00}, {0x0, 0x0, {0x0, 0x0}, {0xc005d99f80, 0x3e}}, 0xc0030a01c0)
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command.go:135 +0x422
golang.org/x/tools/internal/lsp.(*commandHandler).ApplyFix(0xc002af41c0, {0x1057048, 0xc003092d00}, {{0xc00576f3e0, 0xb}, {0xc005d99f80, 0x3e}, {{0x4d, 0x37}, {0x4f, ...}}})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command.go:139 +0x128
golang.org/x/tools/internal/lsp/command.Dispatch({0x1057048, 0xc003092d00}, 0xc0030a0140, {0x105e948, 0xc002af41c0})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command/command_gen.go:90 +0x66f
golang.org/x/tools/internal/lsp.(*Server).executeCommand(0xc0004d0120, {0x1057048, 0xc003092d00}, 0xc0030a0140)
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/command.go:50 +0x17e
golang.org/x/tools/internal/lsp.(*Server).ExecuteCommand(0xc0003c4460?, {0x1057048?, 0xc003092d00?}, 0xc95180?)
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/server_gen.go:128 +0x25
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x1057048, 0xc003092d00}, {0x1063670, 0xc0004d0120}, 0xc00243ade0, {0x10572e8, 0xc003092c40})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/tsserver.go:606 +0x3d94
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x1057048, 0xc003092d00}, 0xc00243ade0, {0x10572e8, 0xc003092c40})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/protocol.go:154 +0x90
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x1057048, 0xc003092d00}, 0xc00243ade0, {0x10572e8?, 0xc003092c40?})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/lsprpc/lsprpc.go:512 +0xa43
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1057048, 0xc003092d00}, 0xc001a43470, {0x10572e8?, 0xc003092c40?})
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:35 +0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:103 +0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	/home/ii64/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:100 +0x20a
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 1, 2022
@gopherbot gopherbot added this to the Unreleased milestone May 1, 2022
@suzmue suzmue modified the milestones: Unreleased, gopls/on-deck May 2, 2022
@suzmue
Copy link
Contributor

suzmue commented May 2, 2022

Thanks for filing this issue! I was able to reproduce with the latest gopls (v0.8.3)

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/403535 mentions this issue: internal/lsp: fix fillstruct for structs with unsafe.Pointer

@findleyr findleyr modified the milestones: gopls/later, gopls/v0.8.4 May 10, 2022
@golang golang locked and limited conversation to collaborators May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants