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
Remove this line from BUILD.bazel: # gazelle:go_naming_convention_external go_default_library.
Run bazel run //:tidy. This will run gazelle's update-repos and update.
What did you expect to see?
I expect the labels for the external Go dependencies to use the import naming convention as is specified here.
What did you see instead?
Some, not all of the labels for the Go dependencies use the import naming convention. For example, a go_library in tools/update_go_repos/BUILD.bazel looks like the following:
When you try to run bazel test //..., you experience the following error:
ERROR: /Users/chuck/code/cgrindel/rules_swift_package_manager/go_naming_convention_ext_repro/tools/update_go_repos/BUILD.bazel:4:11: no such target '@gazelle~0.31.0~go_deps~com_github_bazelbuild_buildtools//build:build': target 'build' not declared in package 'build' defined by /private/var/tmp/_bazel_chuck/6ba9c49fd9b8d8bef05096e7340868b7/external/gazelle~0.31.0~go_deps~com_github_bazelbuild_buildtools/build/BUILD.bazel (Tip: use `query "@com_github_bazelbuild_buildtools//build:*"` to see all the targets in that package) and referenced by '//tools/update_go_repos:update_go_repos_lib'
INFO: Repository rules_bazel_integration_test~0.12.0~bazel_binaries~build_bazel_bazel_.bazelversion instantiated at:
callstack not available
Repository rule bazel_binary defined at:
/private/var/tmp/_bazel_chuck/6ba9c49fd9b8d8bef05096e7340868b7/external/rules_bazel_integration_test~0.12.0/bazel_integration_test/private/bazel_binaries.bzl:113:31: in <toplevel>
ERROR: Analysis of target '//tools/update_go_repos:update_go_repos_lib' failed; build aborted: Analysis failed
While we could work around this issue by force generating BUILD files for buildtools, the better solution is for it to use import_alias to generate its packaged BUILD files. I would say that all Bazel-aware Go repos should do that as otherwise the repo needs to be fetched first for Gazelle to learn the naming convention to use.
I filed bazelbuild/buildtools#1173 to fix this. Please let me know if that fix does not resolve the issue.
What version of gazelle are you using?
0.31.0
What version of rules_go are you using?
0.39.1
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?
MacOS, x86_64
What did you do?
BUILD.bazel
:# gazelle:go_naming_convention_external go_default_library
.bazel run //:tidy
. This will run gazelle'supdate-repos
andupdate
.What did you expect to see?
I expect the labels for the external Go dependencies to use the
import
naming convention as is specified here.What did you see instead?
Some, not all of the labels for the Go dependencies use the
import
naming convention. For example, ago_library
intools/update_go_repos/BUILD.bazel
looks like the following:When you try to run
bazel test //...
, you experience the following error:Other Info
Related to cgrindel/rules_swift_package_manager#410 (comment).
cc: @fmeum
The text was updated successfully, but these errors were encountered: