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
No known key found for this signature in database
GPG key ID: 67B3DED84EDC823F
21 changed files with 402 additions and 403 deletions

View file

@ -984,7 +984,24 @@ func (m *User) Unmarshal(dAtA []byte) error {
} }
} }
case 3: case 3:
if wireType == 2 { if wireType == 0 {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
} else if wireType == 2 {
var packedLen int var packedLen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
@ -1025,23 +1042,6 @@ func (m *User) Unmarshal(dAtA []byte) error {
} }
m.AdditionalGids = append(m.AdditionalGids, v) m.AdditionalGids = append(m.AdditionalGids, v)
} }
} else if wireType == 0 {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
} else { } else {
return fmt.Errorf("proto: wrong wireType = %d for field AdditionalGids", wireType) return fmt.Errorf("proto: wrong wireType = %d for field AdditionalGids", wireType)
} }

View file

@ -18,8 +18,8 @@ github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
github.com/matttproud/golang_protobuf_extensions v1.0.0 github.com/matttproud/golang_protobuf_extensions v1.0.0
# go-units from Docker; latest release as of 12/16/2016 # go-units from Docker; latest release as of 12/16/2016
github.com/docker/go-units v0.3.1 github.com/docker/go-units v0.3.1
# gogo/protobuf - master as of 12/16/2016 (latest tagged release doesn't have needed change) # gogo/protobuf - master as of 2/15/2016 (latest tagged release doesn't have needed change)
github.com/gogo/protobuf 06ec6c31ff1bac6ed4e205a547a3d72934813ef3 github.com/gogo/protobuf d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8
# golang support for protobufs - master as of 12/16/2016 # golang support for protobufs - master as of 12/16/2016
github.com/golang/protobuf 8ee79997227bf9b34611aee7946ae64735e6fd93 github.com/golang/protobuf 8ee79997227bf9b34611aee7946ae64735e6fd93
# runc, latest release as of 12/16/2016 # runc, latest release as of 12/16/2016

View file

@ -64,6 +64,15 @@ var E_EnumCustomname = &proto.ExtensionDesc{
Filename: "gogo.proto", Filename: "gogo.proto",
} }
var E_Enumdecl = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.EnumOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 62024,
Name: "gogoproto.enumdecl",
Tag: "varint,62024,opt,name=enumdecl",
Filename: "gogo.proto",
}
var E_EnumvalueCustomname = &proto.ExtensionDesc{ var E_EnumvalueCustomname = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.EnumValueOptions)(nil), ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
ExtensionType: (*string)(nil), ExtensionType: (*string)(nil),
@ -307,6 +316,24 @@ var E_CompareAll = &proto.ExtensionDesc{
Filename: "gogo.proto", Filename: "gogo.proto",
} }
var E_TypedeclAll = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.FileOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 63030,
Name: "gogoproto.typedecl_all",
Tag: "varint,63030,opt,name=typedecl_all,json=typedeclAll",
Filename: "gogo.proto",
}
var E_EnumdeclAll = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.FileOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 63031,
Name: "gogoproto.enumdecl_all",
Tag: "varint,63031,opt,name=enumdecl_all,json=enumdeclAll",
Filename: "gogo.proto",
}
var E_GoprotoGetters = &proto.ExtensionDesc{ var E_GoprotoGetters = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.MessageOptions)(nil), ExtendedType: (*google_protobuf.MessageOptions)(nil),
ExtensionType: (*bool)(nil), ExtensionType: (*bool)(nil),
@ -505,6 +532,15 @@ var E_Compare = &proto.ExtensionDesc{
Filename: "gogo.proto", Filename: "gogo.proto",
} }
var E_Typedecl = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.MessageOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 64030,
Name: "gogoproto.typedecl",
Tag: "varint,64030,opt,name=typedecl",
Filename: "gogo.proto",
}
var E_Nullable = &proto.ExtensionDesc{ var E_Nullable = &proto.ExtensionDesc{
ExtendedType: (*google_protobuf.FieldOptions)(nil), ExtendedType: (*google_protobuf.FieldOptions)(nil),
ExtensionType: (*bool)(nil), ExtensionType: (*bool)(nil),
@ -609,6 +645,7 @@ func init() {
proto.RegisterExtension(E_GoprotoEnumStringer) proto.RegisterExtension(E_GoprotoEnumStringer)
proto.RegisterExtension(E_EnumStringer) proto.RegisterExtension(E_EnumStringer)
proto.RegisterExtension(E_EnumCustomname) proto.RegisterExtension(E_EnumCustomname)
proto.RegisterExtension(E_Enumdecl)
proto.RegisterExtension(E_EnumvalueCustomname) proto.RegisterExtension(E_EnumvalueCustomname)
proto.RegisterExtension(E_GoprotoGettersAll) proto.RegisterExtension(E_GoprotoGettersAll)
proto.RegisterExtension(E_GoprotoEnumPrefixAll) proto.RegisterExtension(E_GoprotoEnumPrefixAll)
@ -636,6 +673,8 @@ func init() {
proto.RegisterExtension(E_GogoprotoImport) proto.RegisterExtension(E_GogoprotoImport)
proto.RegisterExtension(E_ProtosizerAll) proto.RegisterExtension(E_ProtosizerAll)
proto.RegisterExtension(E_CompareAll) proto.RegisterExtension(E_CompareAll)
proto.RegisterExtension(E_TypedeclAll)
proto.RegisterExtension(E_EnumdeclAll)
proto.RegisterExtension(E_GoprotoGetters) proto.RegisterExtension(E_GoprotoGetters)
proto.RegisterExtension(E_GoprotoStringer) proto.RegisterExtension(E_GoprotoStringer)
proto.RegisterExtension(E_VerboseEqual) proto.RegisterExtension(E_VerboseEqual)
@ -658,6 +697,7 @@ func init() {
proto.RegisterExtension(E_GoprotoUnrecognized) proto.RegisterExtension(E_GoprotoUnrecognized)
proto.RegisterExtension(E_Protosizer) proto.RegisterExtension(E_Protosizer)
proto.RegisterExtension(E_Compare) proto.RegisterExtension(E_Compare)
proto.RegisterExtension(E_Typedecl)
proto.RegisterExtension(E_Nullable) proto.RegisterExtension(E_Nullable)
proto.RegisterExtension(E_Embed) proto.RegisterExtension(E_Embed)
proto.RegisterExtension(E_Customtype) proto.RegisterExtension(E_Customtype)
@ -674,76 +714,79 @@ func init() {
func init() { proto.RegisterFile("gogo.proto", fileDescriptorGogo) } func init() { proto.RegisterFile("gogo.proto", fileDescriptorGogo) }
var fileDescriptorGogo = []byte{ var fileDescriptorGogo = []byte{
// 1129 bytes of a gzipped FileDescriptorProto // 1178 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x97, 0xc9, 0x6f, 0x1c, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x98, 0x4b, 0x6f, 0x1c, 0x45,
0x14, 0x87, 0x85, 0x70, 0x64, 0xcf, 0xf3, 0x86, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0x72, 0xe3, 0xe4, 0x10, 0x80, 0x85, 0x48, 0x64, 0x6f, 0xf9, 0x85, 0xd7, 0xc6, 0x84, 0x08, 0x44, 0x72, 0xe3, 0xe4,
0x9c, 0x22, 0x94, 0xb2, 0x22, 0xcb, 0xb1, 0x9c, 0x51, 0x10, 0x86, 0x91, 0x89, 0x03, 0x88, 0xc3, 0x9c, 0x22, 0x94, 0xb6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0x65, 0xb5, 0x5a, 0xec, 0xa2, 0xff, 0x03, 0x00, 0x00,
0xff, 0xff, 0x06, 0x21, 0xec, 0x88, 0xfd, 0x12, 0x00, 0x00,
} }

View file

@ -39,6 +39,7 @@ extend google.protobuf.EnumOptions {
optional bool goproto_enum_stringer = 62021; optional bool goproto_enum_stringer = 62021;
optional bool enum_stringer = 62022; optional bool enum_stringer = 62022;
optional string enum_customname = 62023; optional string enum_customname = 62023;
optional bool enumdecl = 62024;
} }
extend google.protobuf.EnumValueOptions { extend google.protobuf.EnumValueOptions {
@ -77,6 +78,8 @@ extend google.protobuf.FileOptions {
optional bool gogoproto_import = 63027; optional bool gogoproto_import = 63027;
optional bool protosizer_all = 63028; optional bool protosizer_all = 63028;
optional bool compare_all = 63029; optional bool compare_all = 63029;
optional bool typedecl_all = 63030;
optional bool enumdecl_all = 63031;
} }
extend google.protobuf.MessageOptions { extend google.protobuf.MessageOptions {
@ -107,6 +110,8 @@ extend google.protobuf.MessageOptions {
optional bool protosizer = 64028; optional bool protosizer = 64028;
optional bool compare = 64029; optional bool compare = 64029;
optional bool typedecl = 64030;
} }
extend google.protobuf.FieldOptions { extend google.protobuf.FieldOptions {

View file

@ -90,6 +90,14 @@ func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool {
return false return false
} }
func HasEnumDecl(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool {
return proto.GetBoolExtension(enum.Options, E_Enumdecl, proto.GetBoolExtension(file.Options, E_EnumdeclAll, true))
}
func HasTypeDecl(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool {
return proto.GetBoolExtension(message.Options, E_Typedecl, proto.GetBoolExtension(file.Options, E_TypedeclAll, true))
}
func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { func GetCustomType(field *google_protobuf.FieldDescriptorProto) string {
if field == nil { if field == nil {
return "" return ""

View file

@ -97,8 +97,10 @@ not print their values, while the generated GoString method will always print al
package gostring package gostring
import ( import (
"fmt"
"github.com/gogo/protobuf/gogoproto" "github.com/gogo/protobuf/gogoproto"
"github.com/gogo/protobuf/protoc-gen-gogo/generator" "github.com/gogo/protobuf/protoc-gen-gogo/generator"
"os"
"strconv" "strconv"
"strings" "strings"
) )
@ -145,6 +147,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
reflectPkg := p.NewImport("reflect") reflectPkg := p.NewImport("reflect")
sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys") sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys")
extensionToGoStringUsed := false
for _, message := range file.Messages() { for _, message := range file.Messages() {
if !p.overwrite && !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) { if !p.overwrite && !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) {
continue continue
@ -221,7 +224,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
p.P(`s = append(s, "`, fieldname, `: " + `, mapName, `+ ",\n")`) p.P(`s = append(s, "`, fieldname, `: " + `, mapName, `+ ",\n")`)
p.Out() p.Out()
p.P(`}`) p.P(`}`)
} else if field.IsMessage() || p.IsGroup(field) { } else if (field.IsMessage() && !gogoproto.IsCustomType(field) && !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field)) || p.IsGroup(field) {
if nullable || repeated { if nullable || repeated {
p.P(`if this.`, fieldname, ` != nil {`) p.P(`if this.`, fieldname, ` != nil {`)
p.In() p.In()
@ -264,6 +267,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
if message.DescriptorProto.HasExtension() { if message.DescriptorProto.HasExtension() {
if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
p.P(`s = append(s, "XXX_InternalExtensions: " + extensionToGoString`, p.localName, `(this) + ",\n")`) p.P(`s = append(s, "XXX_InternalExtensions: " + extensionToGoString`, p.localName, `(this) + ",\n")`)
extensionToGoStringUsed = true
} else { } else {
p.P(`if this.XXX_extensions != nil {`) p.P(`if this.XXX_extensions != nil {`)
p.In() p.In()
@ -338,29 +342,34 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
p.Out() p.Out()
p.P(`}`) p.P(`}`)
p.P(`func extensionToGoString`, p.localName, `(m `, protoPkg.Use(), `.Message) string {`) if extensionToGoStringUsed {
p.In() if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
p.P(`e := `, protoPkg.Use(), `.GetUnsafeExtensionsMap(m)`) fmt.Fprintf(os.Stderr, "The GoString plugin for messages with extensions requires importing gogoprotobuf. Please see file %s", file.GetName())
p.P(`if e == nil { return "nil" }`) os.Exit(1)
p.P(`s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"`) }
p.P(`keys := make([]int, 0, len(e))`) p.P(`func extensionToGoString`, p.localName, `(m `, protoPkg.Use(), `.Message) string {`)
p.P(`for k := range e {`) p.In()
p.In() p.P(`e := `, protoPkg.Use(), `.GetUnsafeExtensionsMap(m)`)
p.P(`keys = append(keys, int(k))`) p.P(`if e == nil { return "nil" }`)
p.Out() p.P(`s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"`)
p.P(`}`) p.P(`keys := make([]int, 0, len(e))`)
p.P(sortPkg.Use(), `.Ints(keys)`) p.P(`for k := range e {`)
p.P(`ss := []string{}`) p.In()
p.P(`for _, k := range keys {`) p.P(`keys = append(keys, int(k))`)
p.In() p.Out()
p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`) p.P(`}`)
p.Out() p.P(sortPkg.Use(), `.Ints(keys)`)
p.P(`}`) p.P(`ss := []string{}`)
p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "})"`) p.P(`for _, k := range keys {`)
p.P(`return s`) p.In()
p.Out() p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`)
p.P(`}`) p.Out()
p.P(`}`)
p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "})"`)
p.P(`return s`)
p.Out()
p.P(`}`)
}
} }
func init() { func init() {

View file

@ -420,7 +420,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
p.P(`if m.`, fieldname, ` != nil {`) p.P(`if m.`, fieldname, ` != nil {`)
p.In() p.In()
} }
packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) packed := field.IsPacked() || (proto3 && field.IsPacked3())
wireType := field.WireType() wireType := field.WireType()
fieldNumber := field.GetNumber() fieldNumber := field.GetNumber()
if packed { if packed {

View file

@ -194,7 +194,6 @@ func (p *plugin) getFuncName(goTypName string) string {
case "time.NewPopulatedTime": case "time.NewPopulatedTime":
funcName = p.typesPkg.Use() + ".NewPopulatedStdTime" funcName = p.typesPkg.Use() + ".NewPopulatedStdTime"
case "time.NewPopulatedDuration": case "time.NewPopulatedDuration":
p.typesPkg.Use()
funcName = p.typesPkg.Use() + ".NewPopulatedStdDuration" funcName = p.typesPkg.Use() + ".NewPopulatedStdDuration"
} }
return funcName return funcName
@ -305,6 +304,23 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
} }
p.Out() p.Out()
p.P(`}`) p.P(`}`)
} else if gogoproto.IsCustomType(field) {
funcCall := p.getCustomFuncCall(goTypName)
if field.IsRepeated() {
p.P(p.varGen.Next(), ` := r.Intn(10)`)
p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`)
p.In()
p.P(p.varGen.Next(), `:= `, funcCall)
p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current())
p.Out()
p.P(`}`)
} else if gogoproto.IsNullable(field) {
p.P(`this.`, fieldname, ` = `, funcCall)
} else {
p.P(p.varGen.Next(), `:= `, funcCall)
p.P(`this.`, fieldname, ` = *`, p.varGen.Current())
}
} else if field.IsMessage() || p.IsGroup(field) { } else if field.IsMessage() || p.IsGroup(field) {
funcCall := p.getFuncCall(goTypName) funcCall := p.getFuncCall(goTypName)
if field.IsRepeated() { if field.IsRepeated() {
@ -345,23 +361,6 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
p.P(p.varGen.Next(), ` := `, val) p.P(p.varGen.Next(), ` := `, val)
p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) p.P(`this.`, fieldname, ` = &`, p.varGen.Current())
} }
} else if gogoproto.IsCustomType(field) {
funcCall := p.getCustomFuncCall(goTypName)
if field.IsRepeated() {
p.P(p.varGen.Next(), ` := r.Intn(10)`)
p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`)
p.In()
p.P(p.varGen.Next(), `:= `, funcCall)
p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current())
p.Out()
p.P(`}`)
} else if gogoproto.IsNullable(field) {
p.P(`this.`, fieldname, ` = `, funcCall)
} else {
p.P(p.varGen.Next(), `:= `, funcCall)
p.P(`this.`, fieldname, ` = *`, p.varGen.Current())
}
} else if field.IsBytes() { } else if field.IsBytes() {
if field.IsRepeated() { if field.IsRepeated() {
p.P(p.varGen.Next(), ` := r.Intn(10)`) p.P(p.varGen.Next(), ` := r.Intn(10)`)

View file

@ -230,7 +230,7 @@ func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, messag
p.P(`if m.`, fieldname, ` != nil {`) p.P(`if m.`, fieldname, ` != nil {`)
p.In() p.In()
} }
packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) packed := field.IsPacked() || (proto3 && field.IsPacked3())
_, wire := p.GoType(message, field) _, wire := p.GoType(message, field)
wireType := wireToType(wire) wireType := wireToType(wire)
fieldNumber := field.GetNumber() fieldNumber := field.GetNumber()

View file

@ -203,7 +203,7 @@ func (p *stringer) Generate(file *generator.FileDescriptor) {
} else if p.IsMap(field) { } else if p.IsMap(field) {
mapName := `mapStringFor` + fieldname mapName := `mapStringFor` + fieldname
p.P("`", fieldname, ":`", ` + `, mapName, " + `,", "`,") p.P("`", fieldname, ":`", ` + `, mapName, " + `,", "`,")
} else if field.IsMessage() || p.IsGroup(field) { } else if (field.IsMessage() && !gogoproto.IsCustomType(field)) || p.IsGroup(field) {
desc := p.ObjectNamed(field.GetTypeName()) desc := p.ObjectNamed(field.GetTypeName())
msgname := p.TypeName(desc) msgname := p.TypeName(desc)
msgnames := strings.Split(msgname, ".") msgnames := strings.Split(msgname, ".")

View file

@ -806,10 +806,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
} else { } else {
p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Duration(0))`) 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, `{})`) p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`)
} else { } 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]` varName := `m.` + fieldname + `[len(m.` + fieldname + `)-1]`
buf := `dAtA[iNdEx:postIndex]` buf := `dAtA[iNdEx:postIndex]`
@ -840,7 +843,9 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
} else if gogoproto.IsStdDuration(field) { } else if gogoproto.IsStdDuration(field) {
p.P(`m.`, fieldname, ` = new(time.Duration)`) p.P(`m.`, fieldname, ` = new(time.Duration)`)
} else { } 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.Out()
p.P(`}`) p.P(`}`)
@ -869,6 +874,7 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
p.P(`}`) p.P(`}`)
} }
p.P(`iNdEx = postIndex`) p.P(`iNdEx = postIndex`)
case descriptor.FieldDescriptorProto_TYPE_BYTES: case descriptor.FieldDescriptorProto_TYPE_BYTES:
p.P(`var byteLen int`) p.P(`var byteLen int`)
p.decodeVarint("byteLen", "int") p.decodeVarint("byteLen", "int")
@ -1164,12 +1170,16 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
if field.OneofIndex != nil { if field.OneofIndex != nil {
errFieldname = p.GetOneOfFieldName(message, field) 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.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`)
p.In() p.In()
wireType := field.WireType() wireType := field.WireType()
if packed { if possiblyPacked {
p.P(`if wireType == `, strconv.Itoa(proto.WireBytes), `{`) 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.In()
p.P(`var packedLen int`) p.P(`var packedLen int`)
p.decodeVarint("packedLen", "int") p.decodeVarint("packedLen", "int")
@ -1190,10 +1200,6 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
p.Out() p.Out()
p.P(`}`) p.P(`}`)
p.Out() 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.P(`} else {`)
p.In() p.In()
p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`) p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`)

View file

@ -90,3 +90,29 @@ func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) {
} }
return fd, md return fd, md
} }
// Is this field a scalar numeric type?
func (field *FieldDescriptorProto) IsScalar() bool {
if field.Type == nil {
return false
}
switch *field.Type {
case FieldDescriptorProto_TYPE_DOUBLE,
FieldDescriptorProto_TYPE_FLOAT,
FieldDescriptorProto_TYPE_INT64,
FieldDescriptorProto_TYPE_UINT64,
FieldDescriptorProto_TYPE_INT32,
FieldDescriptorProto_TYPE_FIXED64,
FieldDescriptorProto_TYPE_FIXED32,
FieldDescriptorProto_TYPE_BOOL,
FieldDescriptorProto_TYPE_UINT32,
FieldDescriptorProto_TYPE_ENUM,
FieldDescriptorProto_TYPE_SFIXED32,
FieldDescriptorProto_TYPE_SFIXED64,
FieldDescriptorProto_TYPE_SINT32,
FieldDescriptorProto_TYPE_SINT64:
return true
default:
return false
}
}

View file

@ -99,6 +99,17 @@ func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) {
return x return x
} }
func (field *FieldDescriptorProto) GetKey3Uint64() (x uint64) {
packed := field.IsPacked3()
wireType := field.WireType()
fieldNumber := field.GetNumber()
if packed {
wireType = 2
}
x = uint64(uint32(fieldNumber)<<3 | uint32(wireType))
return x
}
func (field *FieldDescriptorProto) GetKey() []byte { func (field *FieldDescriptorProto) GetKey() []byte {
x := field.GetKeyUint64() x := field.GetKeyUint64()
i := 0 i := 0
@ -111,6 +122,18 @@ func (field *FieldDescriptorProto) GetKey() []byte {
return keybuf return keybuf
} }
func (field *FieldDescriptorProto) GetKey3() []byte {
x := field.GetKey3Uint64()
i := 0
keybuf := make([]byte, 0)
for i = 0; x > 127; i++ {
keybuf = append(keybuf, 0x80|uint8(x&0x7F))
x >>= 7
}
keybuf = append(keybuf, uint8(x))
return keybuf
}
func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto {
msg := desc.GetMessage(packageName, messageName) msg := desc.GetMessage(packageName, messageName)
if msg == nil { if msg == nil {
@ -352,6 +375,16 @@ func (f *FieldDescriptorProto) IsPacked() bool {
return f.Options != nil && f.GetOptions().GetPacked() return f.Options != nil && f.GetOptions().GetPacked()
} }
func (f *FieldDescriptorProto) IsPacked3() bool {
if f.IsRepeated() && f.IsScalar() {
if f.Options == nil || f.GetOptions().Packed == nil {
return true
}
return f.Options != nil && f.GetOptions().GetPacked()
}
return false
}
func (m *DescriptorProto) HasExtension() bool { func (m *DescriptorProto) HasExtension() bool {
return len(m.ExtensionRange) > 0 return len(m.ExtensionRange) > 0
} }

View file

@ -1465,6 +1465,12 @@ func (g *Generator) generateImports() {
g.P("var _ = ", g.Pkg["proto"], ".Marshal") g.P("var _ = ", g.Pkg["proto"], ".Marshal")
g.P("var _ = ", g.Pkg["fmt"], ".Errorf") g.P("var _ = ", g.Pkg["fmt"], ".Errorf")
g.P("var _ = ", g.Pkg["math"], ".Inf") g.P("var _ = ", g.Pkg["math"], ".Inf")
for _, cimport := range g.customImports {
if cimport == "time" {
g.P("var _ = time.Kitchen")
break
}
}
g.P() g.P()
} }
@ -1506,23 +1512,27 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) {
if !gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { if !gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) {
ccPrefix = "" ccPrefix = ""
} }
g.P("type ", ccTypeName, " int32")
g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()})
g.P("const (")
g.In()
for i, e := range enum.Value {
g.PrintComments(fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i))
name := *e.Name
if gogoproto.IsEnumValueCustomName(e) {
name = gogoproto.GetEnumValueCustomName(e)
}
name = ccPrefix + name
g.P(name, " ", ccTypeName, " = ", e.Number) if gogoproto.HasEnumDecl(enum.file, enum.EnumDescriptorProto) {
g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) g.P("type ", ccTypeName, " int32")
g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()})
g.P("const (")
g.In()
for i, e := range enum.Value {
g.PrintComments(fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i))
name := *e.Name
if gogoproto.IsEnumValueCustomName(e) {
name = gogoproto.GetEnumValueCustomName(e)
}
name = ccPrefix + name
g.P(name, " ", ccTypeName, " = ", e.Number)
g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName})
}
g.Out()
g.P(")")
} }
g.Out()
g.P(")")
g.P("var ", ccTypeName, "_name = map[int32]string{") g.P("var ", ccTypeName, "_name = map[int32]string{")
g.In() g.In()
generated := make(map[int32]bool) // avoid duplicate values generated := make(map[int32]bool) // avoid duplicate values
@ -1769,7 +1779,7 @@ func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptor
func needsStar(field *descriptor.FieldDescriptorProto, proto3 bool, allowOneOf bool) bool { func needsStar(field *descriptor.FieldDescriptorProto, proto3 bool, allowOneOf bool) bool {
if isRepeated(field) && if isRepeated(field) &&
(*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE || gogoproto.IsCustomType(field)) &&
(*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) { (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) {
return false return false
} }
@ -2046,10 +2056,6 @@ func (g *Generator) generateMessage(message *Descriptor) {
oneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star oneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star
oneofInsertPoints := make(map[int32]int) // oneof_index => offset of g.Buffer oneofInsertPoints := make(map[int32]int) // oneof_index => offset of g.Buffer
g.PrintComments(message.path)
g.P("type ", ccTypeName, " struct {")
g.In()
// allocNames finds a conflict-free variation of the given strings, // allocNames finds a conflict-free variation of the given strings,
// consistently mutating their suffixes. // consistently mutating their suffixes.
// It returns the same number of strings. // It returns the same number of strings.
@ -2071,7 +2077,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
} }
} }
for i, field := range message.Field { for _, field := range message.Field {
// Allocate the getter and the field at the same time so name // Allocate the getter and the field at the same time so name
// collisions create field/method consistent names. // collisions create field/method consistent names.
// TODO: This allocation occurs based on the order of the fields // TODO: This allocation occurs based on the order of the fields
@ -2083,112 +2089,122 @@ func (g *Generator) generateMessage(message *Descriptor) {
} }
ns := allocNames(base, "Get"+base) ns := allocNames(base, "Get"+base)
fieldName, fieldGetterName := ns[0], ns[1] fieldName, fieldGetterName := ns[0], ns[1]
typename, wiretype := g.GoType(message, field)
jsonName := *field.Name
jsonTag := jsonName + ",omitempty"
repeatedNativeType := (!field.IsMessage() && !gogoproto.IsCustomType(field) && field.IsRepeated())
if !gogoproto.IsNullable(field) && !repeatedNativeType {
jsonTag = jsonName
}
gogoJsonTag := gogoproto.GetJsonTag(field)
if gogoJsonTag != nil {
jsonTag = *gogoJsonTag
}
gogoMoreTags := gogoproto.GetMoreTags(field)
moreTags := ""
if gogoMoreTags != nil {
moreTags = " " + *gogoMoreTags
}
tag := fmt.Sprintf("protobuf:%s json:%q%s", g.goTag(message, field, wiretype), jsonTag, moreTags)
fieldNames[field] = fieldName fieldNames[field] = fieldName
fieldGetterNames[field] = fieldGetterName fieldGetterNames[field] = fieldGetterName
if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE && gogoproto.IsEmbed(field) { }
fieldName = ""
}
oneof := field.OneofIndex != nil && message.allowOneof() if gogoproto.HasTypeDecl(message.file, message.DescriptorProto) {
if oneof && oneofFieldName[*field.OneofIndex] == "" { g.PrintComments(message.path)
odp := message.OneofDecl[int(*field.OneofIndex)] g.P("type ", ccTypeName, " struct {")
fname := allocNames(CamelCase(odp.GetName()))[0] g.In()
// This is the first field of a oneof we haven't seen before. for i, field := range message.Field {
// Generate the union field. fieldName := fieldNames[field]
com := g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex)) typename, wiretype := g.GoType(message, field)
if com { jsonName := *field.Name
g.P("//") jsonTag := jsonName + ",omitempty"
repeatedNativeType := (!field.IsMessage() && !gogoproto.IsCustomType(field) && field.IsRepeated())
if !gogoproto.IsNullable(field) && !repeatedNativeType {
jsonTag = jsonName
} }
g.P("// Types that are valid to be assigned to ", fname, ":") gogoJsonTag := gogoproto.GetJsonTag(field)
// Generate the rest of this comment later, if gogoJsonTag != nil {
// when we've computed any disambiguation. jsonTag = *gogoJsonTag
oneofInsertPoints[*field.OneofIndex] = g.Buffer.Len() }
gogoMoreTags := gogoproto.GetMoreTags(field)
dname := "is" + ccTypeName + "_" + fname moreTags := ""
oneofFieldName[*field.OneofIndex] = fname if gogoMoreTags != nil {
oneofDisc[*field.OneofIndex] = dname moreTags = " " + *gogoMoreTags
otag := `protobuf_oneof:"` + odp.GetName() + `"` }
g.P(fname, " ", dname, " `", otag, "`") tag := fmt.Sprintf("protobuf:%s json:%q%s", g.goTag(message, field, wiretype), jsonTag, moreTags)
} if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE && gogoproto.IsEmbed(field) {
fieldName = ""
if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE {
desc := g.ObjectNamed(field.GetTypeName())
if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() {
m := g.GoMapType(d, field)
typename = m.GoType
mapFieldTypes[field] = typename // record for the getter generation
tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", m.KeyTag, m.ValueTag)
} }
}
fieldTypes[field] = typename oneof := field.OneofIndex != nil && message.allowOneof()
if oneof && oneofFieldName[*field.OneofIndex] == "" {
odp := message.OneofDecl[int(*field.OneofIndex)]
fname := allocNames(CamelCase(odp.GetName()))[0]
if oneof { // This is the first field of a oneof we haven't seen before.
tname := ccTypeName + "_" + fieldName // Generate the union field.
// It is possible for this to collide with a message or enum com := g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex))
// nested in this message. Check for collisions. if com {
for { g.P("//")
ok := true }
for _, desc := range message.nested { g.P("// Types that are valid to be assigned to ", fname, ":")
if CamelCaseSlice(desc.TypeName()) == tname { // Generate the rest of this comment later,
ok = false // when we've computed any disambiguation.
break oneofInsertPoints[*field.OneofIndex] = g.Buffer.Len()
dname := "is" + ccTypeName + "_" + fname
oneofFieldName[*field.OneofIndex] = fname
oneofDisc[*field.OneofIndex] = dname
otag := `protobuf_oneof:"` + odp.GetName() + `"`
g.P(fname, " ", dname, " `", otag, "`")
}
if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE {
desc := g.ObjectNamed(field.GetTypeName())
if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() {
m := g.GoMapType(d, field)
typename = m.GoType
mapFieldTypes[field] = typename // record for the getter generation
tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", m.KeyTag, m.ValueTag)
}
}
fieldTypes[field] = typename
if oneof {
tname := ccTypeName + "_" + fieldName
// It is possible for this to collide with a message or enum
// nested in this message. Check for collisions.
for {
ok := true
for _, desc := range message.nested {
if CamelCaseSlice(desc.TypeName()) == tname {
ok = false
break
}
} }
} for _, enum := range message.enums {
for _, enum := range message.enums { if CamelCaseSlice(enum.TypeName()) == tname {
if CamelCaseSlice(enum.TypeName()) == tname { ok = false
ok = false break
break }
} }
if !ok {
tname += "_"
continue
}
break
} }
if !ok {
tname += "_" oneofTypeName[field] = tname
continue continue
}
break
} }
oneofTypeName[field] = tname g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i))
continue g.P(fieldName, "\t", typename, "\t`", tag, "`")
if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) {
g.RecordTypeUse(field.GetTypeName())
}
} }
if len(message.ExtensionRange) > 0 {
g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i)) if gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) {
g.P(fieldName, "\t", typename, "\t`", tag, "`") g.P(g.Pkg["proto"], ".XXX_InternalExtensions `json:\"-\"`")
if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { } else {
g.RecordTypeUse(field.GetTypeName()) g.P("XXX_extensions\t\t[]byte `protobuf:\"bytes,0,opt\" json:\"-\"`")
}
} }
} if gogoproto.HasUnrecognized(g.file.FileDescriptorProto, message.DescriptorProto) && !message.proto3() {
if len(message.ExtensionRange) > 0 { g.P("XXX_unrecognized\t[]byte `json:\"-\"`")
if gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) {
g.P(g.Pkg["proto"], ".XXX_InternalExtensions `json:\"-\"`")
} else {
g.P("XXX_extensions\t\t[]byte `protobuf:\"bytes,0,opt\" json:\"-\"`")
} }
g.Out()
g.P("}")
} }
if gogoproto.HasUnrecognized(g.file.FileDescriptorProto, message.DescriptorProto) && !message.proto3() {
g.P("XXX_unrecognized\t[]byte `json:\"-\"`")
}
g.Out()
g.P("}")
// Update g.Buffer to list valid oneof types. // Update g.Buffer to list valid oneof types.
// We do this down here, after we've disambiguated the oneof type names. // We do this down here, after we've disambiguated the oneof type names.

View file

@ -20,9 +20,6 @@ import math "math"
import bytes "bytes" import bytes "bytes"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -246,24 +243,6 @@ func valueToGoStringAny(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringAny(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Any) Marshal() (dAtA []byte, err error) { func (m *Any) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -18,9 +18,6 @@ import fmt "fmt"
import math "math" import math "math"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -204,24 +201,6 @@ func valueToGoStringDuration(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringDuration(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Duration) Marshal() (dAtA []byte, err error) { func (m *Duration) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -18,9 +18,6 @@ import fmt "fmt"
import math "math" import math "math"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -127,24 +124,6 @@ func valueToGoStringEmpty(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringEmpty(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Empty) Marshal() (dAtA []byte, err error) { func (m *Empty) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -18,9 +18,6 @@ import fmt "fmt"
import math "math" import math "math"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -350,24 +347,6 @@ func valueToGoStringFieldMask(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringFieldMask(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *FieldMask) Marshal() (dAtA []byte, err error) { func (m *FieldMask) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -22,8 +22,6 @@ import math "math"
import strconv "strconv" import strconv "strconv"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import reflect "reflect" import reflect "reflect"
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
@ -748,24 +746,6 @@ func valueToGoStringStruct(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringStruct(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Struct) Marshal() (dAtA []byte, err error) { func (m *Struct) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -18,9 +18,6 @@ import fmt "fmt"
import math "math" import math "math"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -216,24 +213,6 @@ func valueToGoStringTimestamp(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringTimestamp(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Timestamp) Marshal() (dAtA []byte, err error) { func (m *Timestamp) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View file

@ -28,9 +28,6 @@ import math "math"
import bytes "bytes" import bytes "bytes"
import strings "strings" import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect" import reflect "reflect"
import io "io" import io "io"
@ -899,24 +896,6 @@ func valueToGoStringWrappers(v interface{}, typ string) string {
pv := reflect.Indirect(rv).Interface() pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringWrappers(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *DoubleValue) Marshal() (dAtA []byte, err error) { func (m *DoubleValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)