Cannot build go_library with bazel_skylib 0.9.0
Closed this issue · 9 comments
What version of rules_go are you using?
0.19.1
What version of gazelle are you using?
0.17.0
What version of Bazel are you using?
0.28.1
Does this issue reproduce with the latest releases of all the above?
Yes. Updated gazelle to 0.18.1 and faced same issue.
What operating system and processor architecture are you using?
ubuntu 18. linux_amd64
Any other potentially useful information about your toolchain?
The only thing that changed was that I updated bazel-skylib from 0.8.0 to 0.9.0.
https://github.com/bazelbuild/bazel-skylib/releases/tag/0.9.0
What did you do?
bazel build //:go_default_library
What did you expect to see?
Successful build
What did you see instead?
ERROR: /home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/io_bazel_rules_go/go/tools/coverdata/BUILD.bazel:3:1: in go_tool_library rule @io_bazel_rules_go//go/tools/coverdata:coverdata:
Traceback (most recent call last):
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/io_bazel_rules_go/go/tools/coverdata/BUILD.bazel", line 3
go_tool_library(name = 'coverdata')
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/io_bazel_rules_go/go/private/rules/library.bzl", line 42, in _go_library_impl
go.archive(go, source)
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/io_bazel_rules_go/go/private/actions/archive.bzl", line 218, in go.archive
sets.union(cgo_exports, *[a.cgo_exports for a...])
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/bazel_skylib/lib/new_sets.bzl", line 184, in sets.union
struct(_values = dicts.add(*[s._values ...]))
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/bazel_skylib/lib/new_sets.bzl", line 184, in struct
dicts.add(*[s._values for s in args])
File "/home/preston/.cache/bazel/_bazel_preston/2bf51e8690558a83a0a0514ab422fd4b/external/bazel_skylib/lib/new_sets.bzl", line 184, in dicts.add
s._values
object of type 'list' has no field '_values'
Looks like others have reported similar issue in bazel-skylib. bazelbuild/bazel-skylib#163 (comment)
Looks like others have reported similar issue in bazel-skylib. bazelbuild/bazel-skylib#163 (comment)
Have you solved this problem?
Skylib made a breaking change in 0.9.0.
rules_go should stop using the sets
module, which previously worked on depsets, but is now a separate hash set implementation.
Seems like it's not resolved.
Trying to use Gazelle with Bazel and it throws that error.
Just follow the documentation on how to set it up https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
And it'll throw this
ERROR: /home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/io_bazel_rules_go/go/tools/coverdata/BUILD.bazel:3:1: in go_tool_library rule @io_bazel_rules_go//go/tools/coverdata:coverdata:
Traceback (most recent call last):
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/io_bazel_rules_go/go/tools/coverdata/BUILD.bazel", line 3
go_tool_library(name = 'coverdata')
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/io_bazel_rules_go/go/private/rules/library.bzl", line 42, in _go_library_impl
go.archive(go, source)
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/io_bazel_rules_go/go/private/actions/archive.bzl", line 219, in go.archive
sets.union(cgo_exports, *[a.cgo_exports for a...])
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/bazel_skylib/lib/new_sets.bzl", line 184, in sets.union
struct(_values = dicts.add(*[s._values ...]))
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/bazel_skylib/lib/new_sets.bzl", line 184, in struct
dicts.add(*[s._values for s in args])
File "/home/marcus-sa/.cache/bazel/_bazel_marcus-sa/1aa8b1de9e1400751c2fad12c38095a1/external/bazel_skylib/lib/new_sets.bzl", line 184, in dicts.add
s._values
object of type 'list' has no field '_values'
ERROR: Analysis of target '//:gazelle' failed; build aborted: Analysis of target '@io_bazel_rules_go//go/tools/coverdata:coverdata' failed; build aborted
@marcus-sa #2220 is not released yet. If new need to use a newer version of Skylib, you'll need to user a newer commit of rules_go
with git_repository
.
@jayconrod oh cool, thanks.
Any specific commit or just the one you linked to?
@marcus-sa Tip of master
should be good. That will make sure you have access to the latest Go security releases.
@jayconrod cheers, I'll try it out!