Skip to content

Commit 9f83b18

Browse files
committed
Treat an empty message as nil
In google.golang.org/protobuf, an empty message and nil are interchangeable. golang/protobuf#965 Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent d50b3b1 commit 9f83b18

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/llb/definition.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ type DefinitionOp struct {
2929
inputCache *sync.Map // shared and written among DefinitionOps so avoid race on this map using sync.Map
3030
}
3131

32+
var empty = &pb.Definition{}
33+
3234
// NewDefinitionOp returns a new operation from a marshalled definition.
3335
func NewDefinitionOp(def *pb.Definition) (*DefinitionOp, error) {
34-
if def == nil {
36+
if def == nil || proto.Equal(def, empty) {
3537
return nil, errors.New("invalid nil input definition to definition op")
3638
}
3739

0 commit comments

Comments
 (0)