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

Gazaelle not recognising math/rand/v2 as stdlib #1738

Open
udf2457 opened this issue Feb 22, 2024 · 1 comment
Open

Gazaelle not recognising math/rand/v2 as stdlib #1738

udf2457 opened this issue Feb 22, 2024 · 1 comment

Comments

@udf2457
Copy link

udf2457 commented Feb 22, 2024

What version of gazelle are you using?

0.35.0

What version of rules_go are you using?

0.45.1 (I have also re-tested against 0.46.0, the error persists)

What version of Bazel are you using?

7.0.2

What operating system and processor architecture are you using?

MacOS Apple Silicon

What did you do?

Gazelle appears not to recognise math/rand/v2 is part of stdlib.

I have other code in my repo that uses other parts of go stdlib and I have no issues, its only this new code I've added that uses math/rand/v2 that causes issues (/math/rand/v2 was introduced in go 1.22: https://tip.golang.org/doc/go1.22)

gazelle: finding module path for import math/rand/v2: go: malformed module path "math/rand/v2": missing dot in first path element
ERROR: /Users/<REDACTED>/inet/web/BUILD.bazel:19:8: GoCompilePkg internal/inet/web/web_test.internal.a failed: (Exit 1): builder failed: error executing GoCompilePkg command (from target //internal/inet/web:web_test) bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_go~0.45.1~go_sdk~go_default_sdk/builder_reset/builder compilepkg -sdk external/rules_go~0.45.1~go_sdk~go_default_sdk -installsuffix ... (remaining 39 arguments skipped)
compilepkg: missing strict dependencies:
	/private/var/tmp/_bazel_<REDACTED>/6a5a385c9542352444b50f29eada50c6/sandbox/darwin-sandbox/221/execroot/_main/internal/inet/web/retryclient.go: import of "math/rand/v2"
No dependencies were provided.
Check that imports in Go sources match importpath attributes in deps.
@udf2457
Copy link
Author

udf2457 commented Feb 22, 2024

For anyone who finds this at a later date, the problem was becasue default go_sdk download is 1.21.1, so I had to explicitly name the current version in MODULE.bazel, i.e. go_sdk.download(version = "1.22.0")

Clearly the error message provided by gazelle is incredibly unhelpful, verging on useless though !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant