-
Notifications
You must be signed in to change notification settings - Fork 44
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
Conversation
8eb80ca
to
e49ae8a
Compare
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) |
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.
only pkg/errors
allowed in these repos
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 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) |
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 a bit worried about including this reflect-based clone in this internal logic where no reflect should be needed. Are there other options?
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.
Eg. maybe some of these private functions should not use proto based types.
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.
Ended up just doing the below.
clone := &types.Stat{
Path: from.Path,
Mode: from.Mode,
Uid: from.Uid,
...
}
I triggered CI; looks like there's a small linting failure;
|
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]>
@thaJeztah Thanks! Fixed. |
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 😅) |
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.
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).
This reverts commit d22c3fa, reversing changes made to f098008. Signed-off-by: CrazyMax <[email protected]>
gogo/protobuf has been deprecated since 2022. This change uses Google's code generator instead of gogo/protobuf.