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

Bazel 4.0.0 --incompatible_struct_has_no_methods #294

Closed
qzmfranklin opened this issue Apr 29, 2021 · 0 comments · Fixed by #295
Closed

Bazel 4.0.0 --incompatible_struct_has_no_methods #294

qzmfranklin opened this issue Apr 29, 2021 · 0 comments · Fixed by #295
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug

Comments

@qzmfranklin
Copy link

Bazel 4.0.0
skylib 1.0.3

.bazelrc contains the following flag:

build --incompatible_struct_has_no_methods

Then

load('@bazel_skylib//lib:structs.bzl', 'structs')

structs.to_dict(struct(foo=1))

This yield the error messages resembling the following:

        File "/var/bazel/1000/output_user_root/4967436ade8e5feb89c2f0210af1073a/external/bazel_skylib/lib/structs.bzl", line 29, column 22, in _to_dict
                attributes.remove("to_json")
Error in remove: item "to_json" not found in list

Suggestion: Use hasattr to probe whether the struct has to_proto and to_json or not before removing these two methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants