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

deps: move from github.com/golang/protobuf to google.golang.org/protobuf/proto #6961

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

Clement-Jean
Copy link
Contributor

@Clement-Jean Clement-Jean commented Feb 2, 2024

@dfawley this is the continuation of #6919

I'm still unsure about the reflection package. I read the README there and it says that we shouldn't regenerate the testv3.go file. I see two solutions, either we manually edit the generated file (this was previously done) or we regenerate with an older version of protoc. What do you think?

RELEASE NOTES: none

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Merging #6961 (803dee9) into master (8d735f0) will decrease coverage by 1.38%.
Report is 28 commits behind head on master.
The diff coverage is 90.00%.

❗ Current head 803dee9 differs from pull request most recent head f8b66b5. Consider uploading reports for the commit f8b66b5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6961      +/-   ##
==========================================
- Coverage   83.71%   82.34%   -1.38%     
==========================================
  Files         287      296       +9     
  Lines       30926    31471     +545     
==========================================
+ Hits        25889    25914      +25     
- Misses       3972     4487     +515     
- Partials     1065     1070       +5     
Files Coverage Δ
credentials/credentials.go 87.87% <ø> (ø)
internal/pretty/pretty.go 91.66% <100.00%> (+49.56%) ⬆️
xds/internal/xdsclient/bootstrap/bootstrap.go 74.48% <33.33%> (ø)

... and 38 files with indirect coverage changes

@@ -36,17 +35,17 @@ const jsonIndent = " "
// If marshal fails, it falls back to fmt.Sprintf("%+v").
func ToJSON(e any) string {
switch ee := e.(type) {
case protov1.Message:
case protoadapt.MessageV1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we combine some of this now from below case: protoadapt.MessageV2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1; it would be nice to unify these two codepaths completely, but feel free to disregard if you don't want to do it.

I.e.

if ee, ok := e.(protoadapt.MessageV1); ok {
	e = protoadapt.MessageV2Of(e)
}
switch ee := e.(type) {
	// no case for MessageV1 now
...

I don't know why the existing code sets different MarshalOptions but I highly suspect it's an oversight caused by having two codepaths that do essentially the same thing.

@@ -9,7 +9,6 @@ require (
)

require (
github.com/golang/protobuf v1.5.3 // indirect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are these deps changing without any changes under this sub module?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an indirect dep, so it changes because the grpc deps change.

credentials/credentials.go Show resolved Hide resolved
internal/pretty/pretty.go Show resolved Hide resolved
@arvindbr8 arvindbr8 added the Type: Dependencies Updating/adding/removing dependencies label Feb 6, 2024
@dfawley
Copy link
Member

dfawley commented Feb 6, 2024

I'm still unsure about the reflection package. I read the README there and it says that we shouldn't regenerate the testv3.go file. I see two solutions, either we manually edit the generated file (this was previously done) or we regenerate with an older version of protoc. What do you think?

I don't believe this should be changed. It tests that we will work with old generated code; we'd like to still confirm that fact in our tests.

Copy link

This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

@github-actions github-actions bot added stale and removed stale labels Feb 12, 2024
@arvindbr8
Copy link
Member

@Clement-Jean -- friendly ping here, didnt want the bot to mark this stale

@Clement-Jean
Copy link
Contributor Author

@arvindbr8 could you take a look at the comment on your suggestions? Not entirely sure about how to proceed

@arvindbr8
Copy link
Member

Apologies for the delay -- @Clement-Jean. I have been busy with some internal priorities. Taking a look now.

@arvindbr8
Copy link
Member

Also it is weird that I'm not able to see your reply on my comment. however there was a email notification for it

Do you mean removing the switch and receive a proto.message as ToJSON argument?

you can ignore this comment. That was only a nit to combine the logic in the both the switch cases. Im not too inclined for it

Please let me know if you have other questions.

@Clement-Jean
Copy link
Contributor Author

@arvindbr8 so basically right now we are blocked at this point. We need to wait for @dfawley rewrite of channelz. Once this is done, we can go further and do the change in credentials/credentials.go that you suggested.

@arvindbr8
Copy link
Member

Ah I see.. I would prefer if we could decouple those changes. You can ignore my comment there. I will track that suggestion in Doug's PR.

@arvindbr8
Copy link
Member

Approved. Thanks for the PR. We need 1 more person from the team to take a look at it.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the change. Please see the optional requested change and let us know if you don't want to do it and we can merge this as-is.

@@ -9,7 +9,6 @@ require (
)

require (
github.com/golang/protobuf v1.5.3 // indirect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an indirect dep, so it changes because the grpc deps change.

@@ -36,17 +35,17 @@ const jsonIndent = " "
// If marshal fails, it falls back to fmt.Sprintf("%+v").
func ToJSON(e any) string {
switch ee := e.(type) {
case protov1.Message:
case protoadapt.MessageV1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1; it would be nice to unify these two codepaths completely, but feel free to disregard if you don't want to do it.

I.e.

if ee, ok := e.(protoadapt.MessageV1); ok {
	e = protoadapt.MessageV2Of(e)
}
switch ee := e.(type) {
	// no case for MessageV1 now
...

I don't know why the existing code sets different MarshalOptions but I highly suspect it's an oversight caused by having two codepaths that do essentially the same thing.

@dfawley
Copy link
Member

dfawley commented Feb 28, 2024

Thanks for the PR! I went ahead and made some minor cleanup edits to speed things up; hope that's okay. :)

@dfawley dfawley merged commit 51f9cc0 into grpc:master Feb 28, 2024
11 of 12 checks passed
@Clement-Jean Clement-Jean deleted the remove_old_proto_pkg branch March 20, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants