mirror of
https://github.com/moby/buildkit.git
synced 2026-08-04 06:40:22 +00:00
This ensures different valid protobuf serializations that are sent by frontends will be rewritten into digests that are normalized for the buildkit solver. The most recent example of this is that older frontends would generate protobuf with gogo and the newer buildkit is using the google protobuf library. These produce different serializations and cause the solver to think that identical operations are actually different. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
24 lines
474 B
Go
24 lines
474 B
Go
package pb
|
|
|
|
import proto "google.golang.org/protobuf/proto"
|
|
|
|
func (m *Definition) IsNil() bool {
|
|
return m == nil || m.Metadata == nil
|
|
}
|
|
|
|
func (m *Definition) Marshal() ([]byte, error) {
|
|
return m.MarshalVT()
|
|
}
|
|
|
|
func (m *Definition) Unmarshal(dAtA []byte) error {
|
|
return m.UnmarshalVT(dAtA)
|
|
}
|
|
|
|
func (m *Op) Marshal() ([]byte, error) {
|
|
return proto.MarshalOptions{Deterministic: true}.Marshal(m)
|
|
}
|
|
|
|
func (m *Op) Unmarshal(dAtA []byte) error {
|
|
return m.UnmarshalVT(dAtA)
|
|
}
|