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: Cannot jump to definitions in k8s stage dir #60841

Closed
3Xpl0it3r opened this issue Jun 16, 2023 · 0 comments
Closed

x/tools/gopls: Cannot jump to definitions in k8s stage dir #60841

3Xpl0it3r opened this issue Jun 16, 2023 · 0 comments
Labels
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

@3Xpl0it3r
Copy link

gopls cannot work well in vendor dir; it cannot jump to definitions when trace source go in vendor.

gopls version

➜  vendor git:(master) ✗ gopls version
golang.org/x/tools/gopls v0.12.1
    golang.org/x/tools/gopls@(devel)

go env

GO111MODULE="auto"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/l0calh0st/Library/Caches/go-build"
GOENV="/Users/l0calh0st/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/l0calh0st/Git/Go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/l0calh0st/Git/Go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/opt/homebrew/Cellar/go/1.20.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.20.5/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/Users/l0calh0st/Git/l0calh0st/go/kube-aggregator/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7s/606mx9pd39l1fbghgslk29000000gn/T/go-build736326296=/tmp/go-build -gno-record-gcc-switches -fno-common"

Editor and settings

M.gopls = {
	cmd = { "gopls", "serve", "-debug=localhost:8098" },
	filetypes = { "go", "gomod" },
	root_dir = util.root_pattern("go.work", "go.mod", ".git"),
	settings = {
		gopls = {
			symbolStyle = "Full", -- Full| Dynamic | Package
			------------------------------------------------
			----      Analyses Setting
			------------------------------------------------
			analyses = {
				unusedparams = true,
				unreachable = true,
				fillstruct = true,
			},
			------------------------------------------------
			----      Complete Setting
			------------------------------------------------
			usePlaceholders = true, -- placeholders enables placeholders for function parameters or struct fields in completion responses.
			-- completionBudget = "0ms", -- completionBudget is the soft latency goal for completion requests
			matcher = "Fuzzy", -- matcher sets the algorithm that is used when calculating completion candidates. CaseInsensitive | CaseSensitive | Fuzzy
			completeUnimported = true,
			deepCompletion = true, -- If true, this turns on the ability to return completions from deep inside relevant entities, rather than just the locally accessible ones.
			-- experimentalWatchedFileDelay = "10ms"

			------------------------------------------------
			----      Inlayhint
			------------------------------------------------
			hints = {
				assignVariableTypes = true, -- i/* int*/, j/* int*/ := 0, len(r)-1
				compositeLiteralFields = true, -- {/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
				compositeLiteralTypes = true, -- /*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
				constantValues = true, -- KindNone   Kind = iota/* = 0*/
				functionTypeParameters = true, -- myFoo/*[int, string]*/(1, "hello")
				parameterNames = true, -- parseInt(/* str: */ "123", /* radix: */ 8)
				rangeVariableTypes = true, -- for k/* int*/, v/* string*/ := range []string{} {
			},
		},
	},
	single_file_support = true,
}

Logs

[ERROR][2023-06-16 17:32:21] ...lsp/handlers.lua:535 "2023/06/16 17:32:21 no signature help: cannot find an enclosing function\n\tposition=21:0\n"
[ERROR][2023-06-16 17:45:43] ...lsp/handlers.lua:535 "2023/06/16 17:45:43 no signature help: cannot find an enclosing function\n\tposition=24:0\n"
[ERROR][2023-06-16 17:45:43] ...lsp/handlers.lua:535 "2023/06/16 17:45:43 no signature help: cannot find an enclosing function\n\tposition=21:0\n"
[ERROR][2023-06-16 17:45:45] ...lsp/handlers.lua:535 "2023/06/16 17:45:45 no signature help: cannot find an enclosing function\n\tposition=183:21\n"
[ERROR][2023-06-16 17:45:45] ...lsp/handlers.lua:535 "2023/06/16 17:45:45 no signature help: cannot find an enclosing function\n\tposition=183:21\n"

@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 Jun 16, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jun 16, 2023
@3Xpl0it3r 3Xpl0it3r changed the title x/tools/gopls: Cannot jump to definitions in vendor x/tools/gopls: Cannot jump to definitions in k8s stage dir Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants