vendor: update gogo/protobuf dependency

Updates to the gogo/protobuf dependency are required to correctly
generate time types. We also remove an unused windows dependency.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-02-15 13:13:12 -08:00
parent 3fdd1a688d
commit 4cb31d9615
21 changed files with 402 additions and 403 deletions

View File

@@ -806,10 +806,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
} else {
p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Duration(0))`)
}
} else if nullable {
} else if nullable && !gogoproto.IsCustomType(field) {
p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`)
} else {
p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, msgname, `{})`)
goType, _ := p.GoType(nil, field)
// remove the slice from the type, i.e. []*T -> *T
goType = goType[2:]
p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, goType, `{})`)
}
varName := `m.` + fieldname + `[len(m.` + fieldname + `)-1]`
buf := `dAtA[iNdEx:postIndex]`
@@ -840,7 +843,9 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
} else if gogoproto.IsStdDuration(field) {
p.P(`m.`, fieldname, ` = new(time.Duration)`)
} else {
p.P(`m.`, fieldname, ` = &`, msgname, `{}`)
goType, _ := p.GoType(nil, field)
// remove the star from the type
p.P(`m.`, fieldname, ` = &`, goType[1:], `{}`)
}
p.Out()
p.P(`}`)
@@ -869,6 +874,7 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
p.P(`}`)
}
p.P(`iNdEx = postIndex`)
case descriptor.FieldDescriptorProto_TYPE_BYTES:
p.P(`var byteLen int`)
p.decodeVarint("byteLen", "int")
@@ -1164,12 +1170,16 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
if field.OneofIndex != nil {
errFieldname = p.GetOneOfFieldName(message, field)
}
packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field))
possiblyPacked := field.IsScalar() && field.IsRepeated()
p.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`)
p.In()
wireType := field.WireType()
if packed {
p.P(`if wireType == `, strconv.Itoa(proto.WireBytes), `{`)
if possiblyPacked {
p.P(`if wireType == `, strconv.Itoa(wireType), `{`)
p.In()
p.field(file, message, field, fieldname, false)
p.Out()
p.P(`} else if wireType == `, strconv.Itoa(proto.WireBytes), `{`)
p.In()
p.P(`var packedLen int`)
p.decodeVarint("packedLen", "int")
@@ -1190,10 +1200,6 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
p.Out()
p.P(`}`)
p.Out()
p.P(`} else if wireType == `, strconv.Itoa(wireType), `{`)
p.In()
p.field(file, message, field, fieldname, false)
p.Out()
p.P(`} else {`)
p.In()
p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`)