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

Migrate off of gogo/protobuf #171

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Migrate off of gogo/protobuf #171

merged 1 commit into from
Nov 21, 2023

Conversation

kzys
Copy link
Contributor

@kzys kzys commented Nov 16, 2023

gogo/protobuf has been deprecated since 2022. This change uses Google's code generator instead of gogo/protobuf.

@kzys kzys force-pushed the bye-gogo branch 3 times, most recently from 8eb80ca to e49ae8a Compare November 17, 2023 16:11
clone.go Outdated
clone := proto.Clone(from)
typed, ok := clone.(T)
if !ok {
return zero, fmt.Errorf("failed to cast %+v to %+v", clone, zero)
Copy link
Owner

Choose a reason for hiding this comment

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

only pkg/errors allowed in these repos

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that. Will fix.

clone.go Outdated

func cloneProto[T protoreflect.ProtoMessage](from T) (T, error) {
var zero T
clone := proto.Clone(from)
Copy link
Owner

Choose a reason for hiding this comment

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

I'm a bit worried about including this reflect-based clone in this internal logic where no reflect should be needed. Are there other options?

Copy link
Owner

Choose a reason for hiding this comment

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

Eg. maybe some of these private functions should not use proto based types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ended up just doing the below.

	clone := &types.Stat{
		Path:     from.Path,
		Mode:     from.Mode,
		Uid:      from.Uid,
		...
	}

@thaJeztah
Copy link
Collaborator

I triggered CI; looks like there's a small linting failure;

17.56 receive_test.go:389:6: func `clonePacket` is unused (unused)
17.56 func clonePacket(from *types.Packet) *types.Packet {
17.56      ^

gogo/protobuf has been deprecated since 2022. This change uses Google's
code generator instead of gogo/protobuf.

Signed-off-by: Kazuyoshi Kato <[email protected]>
@kzys
Copy link
Contributor Author

kzys commented Nov 21, 2023

@thaJeztah Thanks! Fixed.

@thaJeztah
Copy link
Collaborator

Awesome; I kicked it again, and it's green now 👍

(I'm not super-familiar with this code, so I'll leave actual review to @tonistiigi, but noticed the PR, and saw CI needed approval 😅)

Copy link
Owner

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Do we need some benchmarks as well to ensure there isn't a big regression in marshal/unmarshal? I think in BuildKit I would like some tests that verify backwards compatibility as well (by including binary proto results from previous version).

@tonistiigi tonistiigi merged commit d22c3fa into tonistiigi:master Nov 21, 2023
10 checks passed
crazy-max added a commit to crazy-max/fsutil that referenced this pull request Jan 24, 2024
This reverts commit d22c3fa, reversing
changes made to f098008.

Signed-off-by: CrazyMax <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants