You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our project uses bazel with a monorepo setup, I am using vscode and trying to get gopls working with my golang projects. The OS I am running is ubuntu 24.04.
package main
import "fmt"
func main() {
fmt.Println("this is an agent in go")
}
What did you see happen?
So compling is fine with the project, the external packages (including the pb.go packages generated from .proto files with bazel) is working well, I can use F12 to go to the definitions, use autofills etc. However, the standard libraries are broken, e.g. fmt, http.
The source code of "fmt" package is there under ***/go_sdk/src directory.
When I hover the mouse on "fmt", it shows error:
could not import fmt (missing metadata for import of "fmt")compilerBrokenImport
If I press F12, it says:
No definition found for "fmt"
What did you expect to see?
When I hover on "fmt" and press F12, vscode should take me to the source code of "fmt".
What version of rules_go are you using?
v0.50.1
What version of gazelle are you using?
v0.39.1
What version of Bazel are you using?
7.1.1
Does this issue reproduce with the latest releases of all the above?
The version above is relatively new I think.
What operating system and processor architecture are you using?
Ubuntu 24.04, x86_64 (Intel(R) Core(TM) i7-10700)
gopls version
(version: v0.17.0 built with go: go1.23.4)
go env
What did you do?
Our project uses bazel with a monorepo setup, I am using vscode and trying to get gopls working with my golang projects. The OS I am running is ubuntu 24.04.
My vscode settings looks like this:
Here is my sample golang code:
What did you see happen?
So compling is fine with the project, the external packages (including the pb.go packages generated from .proto files with bazel) is working well, I can use F12 to go to the definitions, use autofills etc. However, the standard libraries are broken, e.g. fmt, http.
The source code of "fmt" package is there under ***/go_sdk/src directory.
When I hover the mouse on "fmt", it shows error:
could not import fmt (missing metadata for import of "fmt")compilerBrokenImport
If I press F12, it says:
No definition found for "fmt"
What did you expect to see?
When I hover on "fmt" and press F12, vscode should take me to the source code of "fmt".
When I call fmt.***, autofill should work.
Editor and settings
No response
Logs
[Trace - 20:44:31.202 PM] Sending request 'textDocument/hover - (118)'.
Params: {"textDocument":{"uri":"file:///home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go"},"position":{"line":2,"character":11}}
[Error - Received] 20:44:31.202 PM #118 no package data for import "fmt"
[Error - 12:44:31 PM] Request textDocument/hover failed.
Message: no package data for import "fmt"
Code: 0
[Trace - 20:44:31.385 PM] Sending request 'textDocument/hover - (119)'.
Params: {"textDocument":{"uri":"file:///home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go"},"position":{"line":2,"character":10}}
[Error - Received] 20:44:31.385 PM #119 no package data for import "fmt"
[Error - 12:44:31 PM] Request textDocument/hover failed.
Message: no package data for import "fmt"
Code: 0
[Trace - 20:44:31.543 PM] Sending request 'textDocument/codeAction - (120)'.
Params: {"textDocument":{"uri":"file:///home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go"},"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":12}},"context":{"diagnostics":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":12}},"message":"could not import fmt (missing metadata for import of "fmt")","code":"BrokenImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#BrokenImport"},"severity":1,"source":"compiler"}],"only":["quickfix"],"triggerKind":1}}
[Trace - 20:44:31.544 PM] Received response 'textDocument/codeAction - (120)' in 0ms.
Result: null
[Trace - 20:44:31.544 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/12/19 20:44:31 fixImports(filename="/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go"), srcDir="/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go" ...%!(EXTRA string=/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go)\n"}
[Info - 12:44:31 PM] 2024/12/19 20:44:31 fixImports(filename="/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go"), srcDir="/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go/main.go" ...%!(EXTRA string=/home/wanjia-he/Documents/robotics/data_pipeline/upload_agent_go)
The text was updated successfully, but these errors were encountered: