v0.21.2
v0.19.1
2.0.0
Yes
Ubuntu amd64
N/A
blaze run //:gazelle -- update-repos github.com/dgraph-io/badger/v2
(v2 isn't a real directory but an module named in: https://github.com/dgraph-io/badger/blob/master/go.mod)
The result should build
$ blaze build :all
ERROR: /home/mike/.cache/bazel/_bazel_mike/00f1347297fd781be7971b81296fd31c/external/com_github_dgraph_io_badger_v2/pb/BUILD.bazel:10:1: @com_github_dgraph_io_badger_v2//pb:pb_go_proto: no such attribute 'importpath_aliases' in 'go_proto_library' rule
ERROR: /home/mike/.cache/bazel/_bazel_mike/00f1347297fd781be7971b81296fd31c/external/com_github_dgraph_io_badger_v2/pb/BUILD.bazel:4:1: Target '@com_github_dgraph_io_badger_v2//pb:pb.proto' contains an error and its package is in error and referenced by '@com_github_dgraph_io_badger_v2//pb:pb_proto'
ERROR: /home/mike/.cache/bazel/_bazel_mike/00f1347297fd781be7971b81296fd31c/external/com_github_dgraph_io_badger_v2/pb/BUILD.bazel:10:1: Target '@com_github_dgraph_io_badger_v2//pb:pb_proto' contains an error and its package is in error and referenced by '@com_github_dgraph_io_badger_v2//pb:pb_go_proto'
ERROR: /home/mike/.cache/bazel/_bazel_mike/00f1347297fd781be7971b81296fd31c/external/com_github_dgraph_io_badger_v2/pb/BUILD.bazel:18:1: Target '@com_github_dgraph_io_badger_v2//pb:pb_go_proto' contains an error and its package is in error and referenced by '@com_github_dgraph_io_badger_v2//pb:go_default_library'
ERROR: /home/mike/.cache/bazel/_bazel_mike/00f1347297fd781be7971b81296fd31c/external/com_github_dgraph_io_badger_v2/BUILD.bazel:3:1: Target '@com_github_dgraph_io_badger_v2//pb:go_default_library' contains an error and its package is in error and referenced by '@com_github_dgraph_io_badger_v2//:go_default_library'
ERROR: Analysis of target '//collecty:go_default_library' failed; build aborted: Analysis failed
INFO: Elapsed time: 1.602s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded, 203 targets configured)
I see importpath_aliases is defined for go_library, but not go_proto_library? However gazelle generates BUILD files that use them:
go_proto_library(
name = "pb_go_proto",
importpath = "github.com/dgraph-io/badger/v2/pb",
importpath_aliases = ["github.com/dgraph-io/badger/pb"],
proto = ":pb_proto",
visibility = ["//visibility:public"],
)
go_proto_library ought to have this attribute, so this is a bug.
If you don't need the .pb.go files to be generated at build time, and you can use pre-generated proto files instead, you may be able to work around this by setting build_file_proto_mode = "disable" on the go_repository rule. Or "disable_global" on all go_repository rules with protos.
Thanks Jay, I rolled back to an earlier version of the library that didn't use the aliasing stuff. That works for me for now. Thank's for the prompt analysis.
@jayconrod Could you give me some guidance on how this should be fixed, I would like to the go_proto_library rules generated by gazelle.
Most helpful comment
go_proto_libraryought to have this attribute, so this is a bug.If you don't need the .pb.go files to be generated at build time, and you can use pre-generated proto files instead, you may be able to work around this by setting
build_file_proto_mode = "disable"on thego_repositoryrule. Or"disable_global"on allgo_repositoryrules with protos.