-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Update rules_go and gazelle #802
Conversation
fa78b24
to
84a56b3
Compare
This requires/allows the following changes: - rerun Gazelle to regenerate the build files - fix marshal_jsonpb_test to assert correct behavior when EnumsAsInts == false - remove `repositories.bzl` (replaced by @go_googleapis) Also, enforce up-to-date build files in the CI check. Note: this version of the commit includes an out-of-date BUILD file to test the CI check.
What's next to do here? I've lost sight a bit. Do you need anything from us? |
TBH I'm hoping someone who understands this "enums inside maps" issue will appear and tell me what to do. I don't want to change the behavior of grpc-gateway without understanding the consequences. Alternatively, we may be able to keep the old behavior by setting EnumsAsInts appropriately for marshalling and unmarshalling. However, I don't have a lot of time to spend on this, as this is "just" a cleanup task on my side. |
84a56b3
to
cc55347
Compare
If the behavior has been incorrect I think we can safely correct it without worrying about backwards compatibility. Is that simply a matter of copying the fix from the protobuf repo? |
I wasn't able to easily fix |
Regenerating everything should be covered in https://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md#i-want-to-regenerate-the-files-after-making-changes. If fixing the tests is a pain, lets raise an issue and solve it in a separate PR. Is it necessarily part of this cleanup? Don't want to waste your time with red tape. |
The generated code changed with the updated dependencies.
Right I see what happened, we updated our dependency of golang/protobuf, and all of a sudden incorrect behaviour that we depended on was fixed, and now our tests fail. It seems we have to fix it in this PR then. I'm not too familiar with this code unfortunately, so I think we just have to do a little digging to get to the bottom of it. Changing the test is correct, so any part of our json marshaller that is doing the wrong thing is what needs to be fixed now. Is that a correct summary? |
Node tests are failing with:
I wonder if it's just a matter of fixing these tests too? |
Enum values inside maps are now supported.
🤞 |
Node tests are looking good! |
Codecov Report
@@ Coverage Diff @@
## master #802 +/- ##
=======================================
Coverage 53.27% 53.27%
=======================================
Files 30 30
Lines 3369 3369
=======================================
Hits 1795 1795
Misses 1399 1399
Partials 175 175 Continue to review full report at Codecov.
|
Yep, looks like I gave up too quickly. Thanks for the encouragement :) |
|
||
gazelle_dependencies() | ||
|
||
load("@bazel_gazelle//:def.bzl", "go_repository") | ||
load("//:repositories.bzl", "repositories") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not objecting, just trying to learn: Why remove repositories.bzl? Wouldn't it be better to allow third parties to import a repositories.bzl and transitively depend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository defined by repositories.bzl is obsolete, having been replaced by @go_googleapis (created by go_rules_dependencies()). Since repositories.bzl is unable to call go_rules_dependencies() (bazelbuild/bazel#1550) there's nothing left for it to do.
@@ -21,12 +29,10 @@ http_archive( | |||
url = "https://github.com/bazelbuild/buildtools/archive/e90e7cc6ef3e6d08d4ca8a982935c3eed638e058.tar.gz", | |||
) | |||
|
|||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | |||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") | |||
|
|||
gazelle_dependencies() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nob objecting, just trying to learn: Maybe I'm not tracking developments in Bazel world closely enough, but if gazelle_dependencies() is no longer imported, where is this defined? Why does this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gazelle_dependencies is still loaded from bazel_gazelle//:deps.bzl, along with go_repository. The only change here is that two load() statements have been consolidated into one.
I think we should merge this as is. It will probably break people but upstream changed on us and we don't have much of an option. If this behavior is required by integrators there is a parameter they can set. |
# https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L75 | ||
version = "1.1.0" | ||
# https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L52 | ||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master: Could not introduce github.com/grpc-ecosystem/grpc-gateway@master, as it has a dependency on github.com/golang/protobuf with constraint aa810b61a9c79d51363740d207bb46cf8e620ed5, which has no overlap with existing constraint master from github.com/grpc-ecosystem/go-grpc-middleware@master
@achew22 @drigz
broken!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a go dep
but I don't think this change introduced the problem, as even before the version was constrained and would have conflicted with go-grpc-middleware
's constraint. @javasgl Maybe you need to use an override to resolve the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've explained the situation in #829
* Update rules_go and gazelle This requires/allows the following changes: - rerun Gazelle to regenerate the build files - fix marshal_jsonpb_test to assert correct behavior when EnumsAsInts == false - remove `repositories.bzl` (replaced by @go_googleapis) Also, enforce up-to-date build files in the CI check. Note: this version of the commit includes an out-of-date BUILD file to test the CI check. * Update Gopkg.toml and Gopkg.lock * Update generated proto code The generated code changed with the updated dependencies. * Fix node_test Enum values inside maps are now supported.
This requires/allows the following changes:
repositories.bzl
(replaced by @go_googleapis)Also, enforce up-to-date build files in the CI check.