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: bazel gopackages driver reports C source files among Go files, leading to parse errors #56208

Closed
zihaowangcmu opened this issue Oct 13, 2022 · 12 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.

Comments

@zihaowangcmu
Copy link

zihaowangcmu commented Oct 13, 2022

gopls version

v0.9.5

go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN="<...>/wzihao/go/bin"
GOCACHE="<...>/wzihao/.cache/go-build"
GOENV="<...>/wzihao/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-mod=mod"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="<...>/wzihao/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="<...>/wzihao/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="<...>/external/go_sdk"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="<...>/external/go_sdk/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="<...>/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4086805148=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I am using VSCode + Go extension for my project.
In my project I imported "github.com/mattn/go-sqlite3". There are errors related to that.

By default CGO_ENABLED=1, I tried to change it to 0, reload VScode window, but still does not work.

What did you expect to see?

No errors importing "github.com/mattn/go-sqlite3" and the go to features works with it

What did you see instead?

Errorrs when importing and indexing. See logs below.

Editor and settings

No custom settings regarding gopls.

Logs

When hanging on the package, the error message is:
could not import github.com/mattn/go-sqlite3 (cannot parse non-Go file file:///<usr>/.cache/bazel/_bazel_<usr>/<...>/external/com_github_mattn_go_sqlite3/sqlite3-binding.c)

Checking gopls server logs, there is the message:

[Error - 6:24:02 PM] Request textDocument/references failed. Message: cannot parse non-Go file file:///<usr>/.cache/bazel/_bazel_<usr>/<...>/external/com_github_mattn_go_sqlite3/sqlite3-binding.c Code: 0

Checking the folder, this package has a sqlite3-binding.c and a sqlite3-binding.h.
I can build the project without problem, but I can not use the go to feature for some functions because of this problem, which is quite annoying.

Any help is appreciated.

@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 Oct 13, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 13, 2022
@findleyr
Copy link
Contributor

Thanks for providing the repro. We will take a look.

@zihaowangcmu
Copy link
Author

any updates? This is not a blocking issue but affects productivity.

@michaelarusso
Copy link

michaelarusso commented Oct 19, 2022

Hi, I also am experiencing the same problem, just with another repo (gocv : https://github.com/hybridgroup/gocv) which uses cgo and has cpp code in it:

could not import gocv.io/x/gocv (cannot parse non-Go file file:///<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/asyncarray.h)

The code builds and runs fine just as the original issue mentions.

@findleyr
Copy link
Contributor

Thanks for following up. We haven't yet investigated.

Just to confirm, you are both using bazel, right? You have set GOPACKAGESDRIVER?

@michaelarusso
Copy link

Yes to using bazel and I have the following configured in vscode settings:

"go.toolsEnvVars": {
  "GOPACKAGESDRIVER": "${workspaceFolder}/tools/gopackagesdriver.sh"
}

With the contents of that specified gopackagesdriver.sh file being:

#!/usr/bin/env bash
exec bazel run -- @io_bazel_rules_go//go/tools/gopackagesdriver "${@}"

@zihaowangcmu
Copy link
Author

I am using Bazel. The setting is same as michaelarusso:

"go.toolsEnvVars": {
  "GOPACKAGESDRIVER": "${workspaceFolder}/tools/gopackagesdriver.sh"
}

The content has one more line:

export GOPACKAGESDRIVER_BAZEL_BUILD_FLAGS=--strategy=GoStdlibList=local
exec bazel run -- @io_bazel_rules_go//go/tools/gopackagesdriver "${@}"

@findleyr
Copy link
Contributor

We don't really support bazel (see https://github.com/golang/tools/tree/master/gopls#supported-go-versions-and-build-systems), but would gladly accept contributions (or fix minor bugs ourselves) if there is low-hanging fruit.

Based on the nature of the error, I suspect that this may be low-hanging fruit and may even be a logical bug in our code, independent of bazel,

It would take me some time to get set up with bazel. If you want to help debug, I would be curious to see the following:

  1. The relevant output of the go/packages command-line tool x/tools/go/packages/gopackages for your workspace. Is go/packages reporting sqlite3-binding.c as a Go file?
  2. A stack trace for that error source.

@adonovan
Copy link
Member

Could you run this command:

$ export GOPACKAGESDRIVER=...   # use your usual setting 
$ go run golang.org/x/tools/go/packages/gopackages@latest -deps -json //my:app   # enter your app name here

and see how it mentions it sqlite3-binding.c in the output? Perhaps it appears in a CompiledGoFiles list by mistake.

@michaelarusso
Copy link

michaelarusso commented Oct 19, 2022

I tried to use the instructions for go run golang.org/x/tools/go/packages/gopackages@latest -deps -json but it didn't output anything. I instead used echo {} | ./tools/gopackagesdriver.sh file=path/to/file/with/problem.go and here is the relevant output for the gocv package where I experience this issue:

{
  "ID": "@io_gocv_x_gocv//:gocv",
  "Name": "gocv",
  "PkgPath": "gocv.io/x/gocv",
  "GoFiles": [
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/asyncarray.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn_ext.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/gocv.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui_gocv.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_colorcodes.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_colorcodes_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/mat_noprofile.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio_string.go"
  ],
  "CompiledGoFiles": [
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/asyncarray.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/calib3d_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/core_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn_ext.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/dnn_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/features2d_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/gocv.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui_gocv.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/highgui_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgcodecs.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_colorcodes.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_colorcodes_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/imgproc_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/mat_noprofile.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/objdetect.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/photo_string.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/svd.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/version.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/video.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.cpp",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.go",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio.h",
    "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/external/io_gocv_x_gocv/videoio_string.go"
  ],
  "ExportFile": "/<usr>/.cache/bazel/_bazel_russomichael/0961bbf0241ac3833db3822167eb7327/execroot/__main__/bazel-out/k8-fastbuild/bin/external/io_gocv_x_gocv/gocv.x",
  "Imports": {
    "errors": "@io_bazel_rules_go//stdlib:errors",
    "fmt": "@io_bazel_rules_go//stdlib:fmt",
    "image": "@io_bazel_rules_go//stdlib:image",
    "image/color": "@io_bazel_rules_go//stdlib:image/color",
    "reflect": "@io_bazel_rules_go//stdlib:reflect",
    "runtime": "@io_bazel_rules_go//stdlib:runtime",
    "strconv": "@io_bazel_rules_go//stdlib:strconv",
    "sync": "@io_bazel_rules_go//stdlib:sync",
    "unsafe": "@io_bazel_rules_go//stdlib:unsafe"
  }
}

@adonovan
Copy link
Member

adonovan commented Oct 19, 2022

Thanks. It seems pretty clear that the Bazel gopackages driver is including non-Go files among the lists of Go files. I'm not familiar with that program; I suggest you file an issue at https://github.com/bazelbuild/rules_go.

@jayconrod

@adonovan adonovan changed the title x/tools/gopls: cannot parse non-Go file x/tools/gopls: bazel gopackages driver reports C source files among Go files, leading to parse errors Oct 19, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/unplanned Oct 19, 2022
@michaelarusso
Copy link

Thanks. Opened bazelbuild/rules_go#3326

@adonovan
Copy link
Member

Thanks. I'll close this issue now.

@golang golang locked and limited conversation to collaborators Oct 20, 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

5 participants