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

golang.org/x/tools removed vcs package #1579

Closed
malt3 opened this issue Jul 17, 2023 · 6 comments · Fixed by #1603
Closed

golang.org/x/tools removed vcs package #1579

malt3 opened this issue Jul 17, 2023 · 6 comments · Fixed by #1603

Comments

@malt3
Copy link
Contributor

malt3 commented Jul 17, 2023

What version of gazelle are you using?

latest main

What version of rules_go are you using?

latest (v0.41.0)

What version of Bazel are you using?

6.2.1

Does this issue reproduce with the latest releases of all the above?

yes

What operating system and processor architecture are you using?

Ubuntu 22.04 / x86_64

What did you do?

I tried to upgrade golang.org/x/tools in my repo. My repo also uses bazel-gazelle.

What did you expect to see?

The upgrade should suceed.

What did you see instead?

Gazelle does not compile anymore when I use it in my repo. Since it depends on golang.org/x/tools/go/vcs, which has been removed in version v0.11.0, minimum version selection will lead to a missing package:

INFO: Invocation ID: 70b7838e-b211-4814-8453-c488d6156b94
ERROR: /home/malte/.cache/bazel/_bazel_malte/bb1175a64d2f0f71785aea697a0484ea/external/bazel_gazelle/repo/BUILD.bazel:3:11: no such package '@org_golang_x_tools//go/vcs': BUILD file not found in directory 'go/vcs' of external repository @org_golang_x_tools. Add a BUILD file to a directory to mark it as a package. and referenced by '@bazel_gazelle//repo:repo'
ERROR: Analysis of target '//:tidy' failed; build aborted: 
INFO: Elapsed time: 0.236s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
ERROR: Build failed. Not running target

See also: golang/go#57051

@rezass
Copy link

rezass commented Jul 18, 2023

Same problem here

@Geethree
Copy link

Just started seeing this on one project as well.

@sluongng
Copy link
Contributor

the package was moved to https://pkg.go.dev/golang.org/x/tools/go/vcs@v0.1.0-deprecated

So short term: we need to upgrade Gazelle dependencies to include this new module, then update the BUILD file so that fetch_repo_lib has the correct deps.

Long term: we should stop using this package and either vendor in the 2 functions needed, or move to use something else.

@eko
Copy link

eko commented Jul 26, 2023

Forcing golang.org/x/tools module version to v0.10.0 fixed this issue for now.

@Geethree
Copy link

Forcing golang.org/x/tools module version to v0.10.0 fixed this issue for now.

@eko How did you force it? Do you mean just pinning the dependency in your go.mid?

@eko
Copy link

eko commented Jul 28, 2023

Hi @Geethree, yes, just by editing the version in the go.mod file and running these commands again:

$ go mod tidy
$ bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies

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

Successfully merging a pull request may close this issue.

5 participants