gopls version
Build info
golang.org/x/tools/gopls v0.18.1 golang.org/x/tools/gopls@v0.18.1 h1:2xJBNzdImS5u/kV/ZzqDLSvlBSeZX+pWY9uKVP7Pask= github.com/BurntSushi/toml@v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= golang.org/x/exp/typeparams@v0.0.0-20241210194714-1829a127f884 h1:1xaZTydL5Gsg78QharTwKfA9FY9CZ1VQj6D/AZEvHR0= golang.org/x/mod@v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= golang.org/x/sync@v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= golang.org/x/telemetry@v0.0.0-20241220003058-cc96b6e0d3d9 h1:L2k9GUV2TpQKVRGMjN94qfUMgUwOFimSQ6gipyJIjKw= golang.org/x/text@v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= golang.org/x/tools@v0.30.1-0.20250221230316-5055f70f240c h1:Ja/5gV5a9Vvho3p2NC/T2TtxhHjrWS/2DvCKMvA0a+Y= golang.org/x/vuln@v1.1.3 h1:NPGnvPOTgnjBc9HTaUx+nj+EaUYxl5SJOWqaDYGaFYw= honnef.co/go/tools@v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= mvdan.cc/gofumpt@v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8= go: go1.24.1
go env
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN='/Users/ariel/go/bin'
GOCACHE='/Users/ariel/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/ariel/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/_c/mpmdn7k9503ff_hrbg5sj7nh0000gn/T/go-build4247256077=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='private/go.mod'
GOMODCACHE='/Users/ariel/go/pkg/mod'
GONOPROXY='pirvate'
GONOSUMDB='private'
GOOS='darwin'
GOPATH='/Users/ariel/go'
GOPRIVATE='pirvate'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.24.1/libexec'
GOSUMDB='off'
GOTELEMETRY='off'
GOTELEMETRYDIR='/Users/ariel/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.24.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Suggest I have such code with struct that embeds other structure as pointer.
type OtherStruct struct {
Some int
}
type MyStruct struct {
*OtherStruct
}
func init() {
var v MyStruct
_ = v.Some // <- cursor here
}
I put my point (cursor) on v.Some, exactly on Some word to know its type.
What did you see happen?
In minibuffer, and with doc buffer "shift + k" I have following:
field Some int
field Some int
---
(mypkg.MyStruct).Some on pkg.go.dev
I found this message a little bit confusing, when I try to understand if field may cause nil pointer dereference panic.
What did you expect to see?
I think it will be better to show this declaration fully as:
field *OtherStruct.Some int
It shows that it is from an embedded structure which is a pointer.
Otherwise it may show an embedded structure as a provider like this:
field Some int // Provided by *OtherStruct.Some
Editor and settings
Default, stock Doom Emacs with Eglot and gopls.
:language
(go +lsp)
Logs
No response
Comment From: madelinekalil
This information is also available via a "find all references" query on v.Some
. The cursor (hover) docs message functionality focuses more on local type information.