-
-
Notifications
You must be signed in to change notification settings - Fork 678
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
VS Code setup of language server fails to load packages. #3110
Comments
As I imagined, this seems to be related to go not wanting to see a symlink. The issue seems to have been introduced with cl/380475/ there is cl/383995/ which attempts to fix the issue, but I am unsure if this was tested or if it plays nicely with bazel. I checked the contents of |
Getting the same issue, which forces me to revert to go 1.17.6 for now. It is indeed quite annoying. |
👋 we think we figured out the smallest patch to work around this issue, but we're not sure about all the implications. like @sambatyon explains above, the issue was introduced in cl/380475/. cl/383995/ does try to solve the issue for some tests in the Go repo but it doesn't attempt to fix it for anything else. looking at the contents of the ~/testproject $ ls bazel-testproject/external/go_sdk/src/crypto/elliptic/
elliptic.go export_generate.go gen_p256_table.go p224.go p256.go p256_asm_amd64.s p256_asm_ppc64le.s p256_asm_table.bin p256_generic.go p256_s390x.go p384.go
elliptic_test.go fuzz_test.go internal p224_test.go p256_asm.go p256_asm_arm64.s p256_asm_s390x.s p256_asm_table_test.go p256_ppc64le.go p256_test.go p521.go we can also inspect the contents of //go:build amd64 || arm64
package elliptic
import (
_ "embed"
"math/big"
)
//go:generate go run -tags=tablegen gen_p256_table.go
//go:embed p256_asm_table.bin <--- THE EMBEDDED FILE at a glance this doesn't seem like an issue because none of the files are symlinks (note that go's embed package is expected not to work symlinks). so we tried re-running the # formatted for readability
bazel build \
--tool_tag=gopackagesdriver \
--ui_actions_shown=0 \
--show_result=0 \
--build_event_json_file=/var/folders/4v/gx_xc2fn1pj9pj8yd8bdnl9r0000gn/T/gopackagesdriver_bep_252991413 \
--build_event_json_file_path_conversion=no \
--experimental_convenience_symlinks=ignore \
--ui_event_filters=-info,-stderr \
--noshow_progress \
--aspects=@io_bazel_rules_go//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect \
--output_groups=go_pkg_driver_json_file,go_pkg_driver_stdlib_json_file,go_pkg_driver_srcs \
--keep_going \
--sandbox_debug \
--verbose_failures \
//example:example the output for this is pretty useful:
with this, we cd into the sandbox: /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/sandbox/darwin-sandbox/7/execroot/testproject $ ls -la external/go_sdk/src/crypto/elliptic/
# ...
lrwxr-xr-x 1 ricard.sole wheel 137 May 11 09:16 p256_asm.go -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm.go
lrwxr-xr-x 1 ricard.sole wheel 142 May 11 09:16 p256_asm_amd64.s -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm_amd64.s
lrwxr-xr-x 1 ricard.sole wheel 142 May 11 09:16 p256_asm_arm64.s -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm_arm64.s
lrwxr-xr-x 1 ricard.sole wheel 144 May 11 09:16 p256_asm_ppc64le.s -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm_ppc64le.s
lrwxr-xr-x 1 ricard.sole wheel 142 May 11 09:16 p256_asm_s390x.s -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm_s390x.s
lrwxr-xr-x 1 ricard.sole wheel 144 May 11 09:16 p256_asm_table.bin -> /private/var/tmp/_bazel_ricard.sole/687eea90887650a4f8ab9d09222d1974/execroot/testproject/external/go_sdk/src/crypto/elliptic/p256_asm_table.bin
# ... now we cd into the execroot instead with if this seems like a reasonable fix/workaround, i'm happy to send a patch. note: after running it with strategy local, if you need/want to revert the strategy you will need to add the flag |
Thanks for posting your investigation. For what it's worth, when I ran gopackagesdriver with
I saw an error on the bazel query step:
Instead, I changed our gopackagesdriver bash script to be: GOPACKAGESDRIVER_BAZEL_BUILD_FLAGS=--strategy=GoStdlibList=local
exec bazel run -- @io_bazel_rules_go//go/tools/gopackagesdriver "$@" Where it used to be just the second line. Adding this in case it helps someone else. |
@brianwolfe good catch, I meant to call out the flag for |
Is this fixed? I tried adding
error |
In case it helps others, I found that it only worked when adding the local strategy into my VS settings:
|
What version of rules_go are you using?
v0.31.0
What version of gazelle are you using?
v0.24.0
What version of Bazel are you using?
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
macOS Monterrey 12.3.1 (Apple M1 Max)
Any other potentially useful information about your toolchain?
Setting up the toolchain with:
System's go:
Running locally
What did you do?
Followed the instructions in Editor Setup. Current
.vscode/settings.json
contents are:golang code is under a directory called
golang/testproject
, there there is a build file:Any import in my go files shows a diagnostics error, which hovering shows:
gopls log within VS Code shows:
Checking the output of
gopackagesdriver.sh
yields:Checking from other people with similar problems I attempted clearing the go cache:
As well as resetting ownership of the cache:
Building and running the binaries succeed without problems.
What did you expect to see?
Features related to the standard library do not work:
However modules internal to the project can be used without problems.
What did you see instead?
The text was updated successfully, but these errors were encountered: