Vendor dependencies for GCS
This commit is contained in:
parent
ba75a3884c
commit
8ca6a9a240
1228 changed files with 1769186 additions and 1 deletions
33
vendor/github.com/golang/protobuf/protoc-gen-go/Makefile
generated
vendored
Normal file
33
vendor/github.com/golang/protobuf/protoc-gen-go/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
test:
|
||||
cd testdata && make test
|
36
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile
generated
vendored
Normal file
36
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Not stored here, but descriptor.proto is in https://github.com/google/protobuf/
|
||||
# at src/google/protobuf/descriptor.proto
|
||||
regenerate:
|
||||
@echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION
|
||||
protoc --go_out=../../../../.. -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto
|
2152
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go
generated
vendored
Normal file
2152
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
51
vendor/github.com/golang/protobuf/protoc-gen-go/doc.go
generated
vendored
Normal file
51
vendor/github.com/golang/protobuf/protoc-gen-go/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/*
|
||||
A plugin for the Google protocol buffer compiler to generate Go code.
|
||||
Run it by building this program and putting it in your path with the name
|
||||
protoc-gen-go
|
||||
That word 'go' at the end becomes part of the option string set for the
|
||||
protocol compiler, so once the protocol compiler (protoc) is installed
|
||||
you can run
|
||||
protoc --go_out=output_directory input_directory/file.proto
|
||||
to generate Go bindings for the protocol defined by file.proto.
|
||||
With that input, the output will be written to
|
||||
output_directory/file.pb.go
|
||||
|
||||
The generated code is documented in the package comment for
|
||||
the library.
|
||||
|
||||
See the README and documentation for protocol buffers to learn more:
|
||||
https://developers.google.com/protocol-buffers/
|
||||
|
||||
*/
|
||||
package documentation
|
40
vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile
generated
vendored
Normal file
40
vendor/github.com/golang/protobuf/protoc-gen-go/generator/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=github.com/golang/protobuf/compiler/generator
|
||||
GOFILES=\
|
||||
generator.go\
|
||||
|
||||
DEPS=../descriptor ../plugin ../../proto
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
2805
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
Normal file
2805
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
85
vendor/github.com/golang/protobuf/protoc-gen-go/generator/name_test.go
generated
vendored
Normal file
85
vendor/github.com/golang/protobuf/protoc-gen-go/generator/name_test.go
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package generator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||
)
|
||||
|
||||
func TestCamelCase(t *testing.T) {
|
||||
tests := []struct {
|
||||
in, want string
|
||||
}{
|
||||
{"one", "One"},
|
||||
{"one_two", "OneTwo"},
|
||||
{"_my_field_name_2", "XMyFieldName_2"},
|
||||
{"Something_Capped", "Something_Capped"},
|
||||
{"my_Name", "My_Name"},
|
||||
{"OneTwo", "OneTwo"},
|
||||
{"_", "X"},
|
||||
{"_a_", "XA_"},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
if got := CamelCase(tc.in); got != tc.want {
|
||||
t.Errorf("CamelCase(%q) = %q, want %q", tc.in, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGoPackageOption(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
impPath, pkg string
|
||||
ok bool
|
||||
}{
|
||||
{"", "", "", false},
|
||||
{"foo", "", "foo", true},
|
||||
{"github.com/golang/bar", "github.com/golang/bar", "bar", true},
|
||||
{"github.com/golang/bar;baz", "github.com/golang/bar", "baz", true},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
d := &FileDescriptor{
|
||||
FileDescriptorProto: &descriptor.FileDescriptorProto{
|
||||
Options: &descriptor.FileOptions{
|
||||
GoPackage: &tc.in,
|
||||
},
|
||||
},
|
||||
}
|
||||
impPath, pkg, ok := d.goPackageOption()
|
||||
if impPath != tc.impPath || pkg != tc.pkg || ok != tc.ok {
|
||||
t.Errorf("go_package = %q => (%q, %q, %t), want (%q, %q, %t)", tc.in,
|
||||
impPath, pkg, ok, tc.impPath, tc.pkg, tc.ok)
|
||||
}
|
||||
}
|
||||
}
|
463
vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go
generated
vendored
Normal file
463
vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go
generated
vendored
Normal file
|
@ -0,0 +1,463 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Package grpc outputs gRPC service descriptions in Go code.
|
||||
// It runs as a plugin for the Go protocol buffer compiler plugin.
|
||||
// It is linked in to protoc-gen-go.
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pb "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||
"github.com/golang/protobuf/protoc-gen-go/generator"
|
||||
)
|
||||
|
||||
// generatedCodeVersion indicates a version of the generated code.
|
||||
// It is incremented whenever an incompatibility between the generated code and
|
||||
// the grpc package is introduced; the generated code references
|
||||
// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion).
|
||||
const generatedCodeVersion = 4
|
||||
|
||||
// Paths for packages used by code generated in this file,
|
||||
// relative to the import_prefix of the generator.Generator.
|
||||
const (
|
||||
contextPkgPath = "golang.org/x/net/context"
|
||||
grpcPkgPath = "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
generator.RegisterPlugin(new(grpc))
|
||||
}
|
||||
|
||||
// grpc is an implementation of the Go protocol buffer compiler's
|
||||
// plugin architecture. It generates bindings for gRPC support.
|
||||
type grpc struct {
|
||||
gen *generator.Generator
|
||||
}
|
||||
|
||||
// Name returns the name of this plugin, "grpc".
|
||||
func (g *grpc) Name() string {
|
||||
return "grpc"
|
||||
}
|
||||
|
||||
// The names for packages imported in the generated code.
|
||||
// They may vary from the final path component of the import path
|
||||
// if the name is used by other packages.
|
||||
var (
|
||||
contextPkg string
|
||||
grpcPkg string
|
||||
)
|
||||
|
||||
// Init initializes the plugin.
|
||||
func (g *grpc) Init(gen *generator.Generator) {
|
||||
g.gen = gen
|
||||
contextPkg = generator.RegisterUniquePackageName("context", nil)
|
||||
grpcPkg = generator.RegisterUniquePackageName("grpc", nil)
|
||||
}
|
||||
|
||||
// Given a type name defined in a .proto, return its object.
|
||||
// Also record that we're using it, to guarantee the associated import.
|
||||
func (g *grpc) objectNamed(name string) generator.Object {
|
||||
g.gen.RecordTypeUse(name)
|
||||
return g.gen.ObjectNamed(name)
|
||||
}
|
||||
|
||||
// Given a type name defined in a .proto, return its name as we will print it.
|
||||
func (g *grpc) typeName(str string) string {
|
||||
return g.gen.TypeName(g.objectNamed(str))
|
||||
}
|
||||
|
||||
// P forwards to g.gen.P.
|
||||
func (g *grpc) P(args ...interface{}) { g.gen.P(args...) }
|
||||
|
||||
// Generate generates code for the services in the given file.
|
||||
func (g *grpc) Generate(file *generator.FileDescriptor) {
|
||||
if len(file.FileDescriptorProto.Service) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
g.P("// Reference imports to suppress errors if they are not otherwise used.")
|
||||
g.P("var _ ", contextPkg, ".Context")
|
||||
g.P("var _ ", grpcPkg, ".ClientConn")
|
||||
g.P()
|
||||
|
||||
// Assert version compatibility.
|
||||
g.P("// This is a compile-time assertion to ensure that this generated file")
|
||||
g.P("// is compatible with the grpc package it is being compiled against.")
|
||||
g.P("const _ = ", grpcPkg, ".SupportPackageIsVersion", generatedCodeVersion)
|
||||
g.P()
|
||||
|
||||
for i, service := range file.FileDescriptorProto.Service {
|
||||
g.generateService(file, service, i)
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateImports generates the import declaration for this file.
|
||||
func (g *grpc) GenerateImports(file *generator.FileDescriptor) {
|
||||
if len(file.FileDescriptorProto.Service) == 0 {
|
||||
return
|
||||
}
|
||||
g.P("import (")
|
||||
g.P(contextPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath)))
|
||||
g.P(grpcPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, grpcPkgPath)))
|
||||
g.P(")")
|
||||
g.P()
|
||||
}
|
||||
|
||||
// reservedClientName records whether a client name is reserved on the client side.
|
||||
var reservedClientName = map[string]bool{
|
||||
// TODO: do we need any in gRPC?
|
||||
}
|
||||
|
||||
func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] }
|
||||
|
||||
// generateService generates all the code for the named service.
|
||||
func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) {
|
||||
path := fmt.Sprintf("6,%d", index) // 6 means service.
|
||||
|
||||
origServName := service.GetName()
|
||||
fullServName := origServName
|
||||
if pkg := file.GetPackage(); pkg != "" {
|
||||
fullServName = pkg + "." + fullServName
|
||||
}
|
||||
servName := generator.CamelCase(origServName)
|
||||
|
||||
g.P()
|
||||
g.P("// Client API for ", servName, " service")
|
||||
g.P()
|
||||
|
||||
// Client interface.
|
||||
g.P("type ", servName, "Client interface {")
|
||||
for i, method := range service.Method {
|
||||
g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service.
|
||||
g.P(g.generateClientSignature(servName, method))
|
||||
}
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Client structure.
|
||||
g.P("type ", unexport(servName), "Client struct {")
|
||||
g.P("cc *", grpcPkg, ".ClientConn")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewClient factory.
|
||||
g.P("func New", servName, "Client (cc *", grpcPkg, ".ClientConn) ", servName, "Client {")
|
||||
g.P("return &", unexport(servName), "Client{cc}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
var methodIndex, streamIndex int
|
||||
serviceDescVar := "_" + servName + "_serviceDesc"
|
||||
// Client method implementations.
|
||||
for _, method := range service.Method {
|
||||
var descExpr string
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
// Unary RPC method
|
||||
descExpr = fmt.Sprintf("&%s.Methods[%d]", serviceDescVar, methodIndex)
|
||||
methodIndex++
|
||||
} else {
|
||||
// Streaming RPC method
|
||||
descExpr = fmt.Sprintf("&%s.Streams[%d]", serviceDescVar, streamIndex)
|
||||
streamIndex++
|
||||
}
|
||||
g.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr)
|
||||
}
|
||||
|
||||
g.P("// Server API for ", servName, " service")
|
||||
g.P()
|
||||
|
||||
// Server interface.
|
||||
serverType := servName + "Server"
|
||||
g.P("type ", serverType, " interface {")
|
||||
for i, method := range service.Method {
|
||||
g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service.
|
||||
g.P(g.generateServerSignature(servName, method))
|
||||
}
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Server registration.
|
||||
g.P("func Register", servName, "Server(s *", grpcPkg, ".Server, srv ", serverType, ") {")
|
||||
g.P("s.RegisterService(&", serviceDescVar, `, srv)`)
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Server handler implementations.
|
||||
var handlerNames []string
|
||||
for _, method := range service.Method {
|
||||
hname := g.generateServerMethod(servName, fullServName, method)
|
||||
handlerNames = append(handlerNames, hname)
|
||||
}
|
||||
|
||||
// Service descriptor.
|
||||
g.P("var ", serviceDescVar, " = ", grpcPkg, ".ServiceDesc {")
|
||||
g.P("ServiceName: ", strconv.Quote(fullServName), ",")
|
||||
g.P("HandlerType: (*", serverType, ")(nil),")
|
||||
g.P("Methods: []", grpcPkg, ".MethodDesc{")
|
||||
for i, method := range service.Method {
|
||||
if method.GetServerStreaming() || method.GetClientStreaming() {
|
||||
continue
|
||||
}
|
||||
g.P("{")
|
||||
g.P("MethodName: ", strconv.Quote(method.GetName()), ",")
|
||||
g.P("Handler: ", handlerNames[i], ",")
|
||||
g.P("},")
|
||||
}
|
||||
g.P("},")
|
||||
g.P("Streams: []", grpcPkg, ".StreamDesc{")
|
||||
for i, method := range service.Method {
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
continue
|
||||
}
|
||||
g.P("{")
|
||||
g.P("StreamName: ", strconv.Quote(method.GetName()), ",")
|
||||
g.P("Handler: ", handlerNames[i], ",")
|
||||
if method.GetServerStreaming() {
|
||||
g.P("ServerStreams: true,")
|
||||
}
|
||||
if method.GetClientStreaming() {
|
||||
g.P("ClientStreams: true,")
|
||||
}
|
||||
g.P("},")
|
||||
}
|
||||
g.P("},")
|
||||
g.P("Metadata: \"", file.GetName(), "\",")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
// generateClientSignature returns the client-side signature for a method.
|
||||
func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string {
|
||||
origMethName := method.GetName()
|
||||
methName := generator.CamelCase(origMethName)
|
||||
if reservedClientName[methName] {
|
||||
methName += "_"
|
||||
}
|
||||
reqArg := ", in *" + g.typeName(method.GetInputType())
|
||||
if method.GetClientStreaming() {
|
||||
reqArg = ""
|
||||
}
|
||||
respName := "*" + g.typeName(method.GetOutputType())
|
||||
if method.GetServerStreaming() || method.GetClientStreaming() {
|
||||
respName = servName + "_" + generator.CamelCase(origMethName) + "Client"
|
||||
}
|
||||
return fmt.Sprintf("%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)", methName, contextPkg, reqArg, grpcPkg, respName)
|
||||
}
|
||||
|
||||
func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) {
|
||||
sname := fmt.Sprintf("/%s/%s", fullServName, method.GetName())
|
||||
methName := generator.CamelCase(method.GetName())
|
||||
inType := g.typeName(method.GetInputType())
|
||||
outType := g.typeName(method.GetOutputType())
|
||||
|
||||
g.P("func (c *", unexport(servName), "Client) ", g.generateClientSignature(servName, method), "{")
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
g.P("out := new(", outType, ")")
|
||||
// TODO: Pass descExpr to Invoke.
|
||||
g.P("err := ", grpcPkg, `.Invoke(ctx, "`, sname, `", in, out, c.cc, opts...)`)
|
||||
g.P("if err != nil { return nil, err }")
|
||||
g.P("return out, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
return
|
||||
}
|
||||
streamType := unexport(servName) + methName + "Client"
|
||||
g.P("stream, err := ", grpcPkg, ".NewClientStream(ctx, ", descExpr, `, c.cc, "`, sname, `", opts...)`)
|
||||
g.P("if err != nil { return nil, err }")
|
||||
g.P("x := &", streamType, "{stream}")
|
||||
if !method.GetClientStreaming() {
|
||||
g.P("if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }")
|
||||
g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }")
|
||||
}
|
||||
g.P("return x, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
genSend := method.GetClientStreaming()
|
||||
genRecv := method.GetServerStreaming()
|
||||
genCloseAndRecv := !method.GetServerStreaming()
|
||||
|
||||
// Stream auxiliary types and methods.
|
||||
g.P("type ", servName, "_", methName, "Client interface {")
|
||||
if genSend {
|
||||
g.P("Send(*", inType, ") error")
|
||||
}
|
||||
if genRecv {
|
||||
g.P("Recv() (*", outType, ", error)")
|
||||
}
|
||||
if genCloseAndRecv {
|
||||
g.P("CloseAndRecv() (*", outType, ", error)")
|
||||
}
|
||||
g.P(grpcPkg, ".ClientStream")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
g.P("type ", streamType, " struct {")
|
||||
g.P(grpcPkg, ".ClientStream")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
if genSend {
|
||||
g.P("func (x *", streamType, ") Send(m *", inType, ") error {")
|
||||
g.P("return x.ClientStream.SendMsg(m)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
if genRecv {
|
||||
g.P("func (x *", streamType, ") Recv() (*", outType, ", error) {")
|
||||
g.P("m := new(", outType, ")")
|
||||
g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }")
|
||||
g.P("return m, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
if genCloseAndRecv {
|
||||
g.P("func (x *", streamType, ") CloseAndRecv() (*", outType, ", error) {")
|
||||
g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }")
|
||||
g.P("m := new(", outType, ")")
|
||||
g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }")
|
||||
g.P("return m, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
}
|
||||
|
||||
// generateServerSignature returns the server-side signature for a method.
|
||||
func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string {
|
||||
origMethName := method.GetName()
|
||||
methName := generator.CamelCase(origMethName)
|
||||
if reservedClientName[methName] {
|
||||
methName += "_"
|
||||
}
|
||||
|
||||
var reqArgs []string
|
||||
ret := "error"
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
reqArgs = append(reqArgs, contextPkg+".Context")
|
||||
ret = "(*" + g.typeName(method.GetOutputType()) + ", error)"
|
||||
}
|
||||
if !method.GetClientStreaming() {
|
||||
reqArgs = append(reqArgs, "*"+g.typeName(method.GetInputType()))
|
||||
}
|
||||
if method.GetServerStreaming() || method.GetClientStreaming() {
|
||||
reqArgs = append(reqArgs, servName+"_"+generator.CamelCase(origMethName)+"Server")
|
||||
}
|
||||
|
||||
return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret
|
||||
}
|
||||
|
||||
func (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string {
|
||||
methName := generator.CamelCase(method.GetName())
|
||||
hname := fmt.Sprintf("_%s_%s_Handler", servName, methName)
|
||||
inType := g.typeName(method.GetInputType())
|
||||
outType := g.typeName(method.GetOutputType())
|
||||
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
g.P("func ", hname, "(srv interface{}, ctx ", contextPkg, ".Context, dec func(interface{}) error, interceptor ", grpcPkg, ".UnaryServerInterceptor) (interface{}, error) {")
|
||||
g.P("in := new(", inType, ")")
|
||||
g.P("if err := dec(in); err != nil { return nil, err }")
|
||||
g.P("if interceptor == nil { return srv.(", servName, "Server).", methName, "(ctx, in) }")
|
||||
g.P("info := &", grpcPkg, ".UnaryServerInfo{")
|
||||
g.P("Server: srv,")
|
||||
g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", fullServName, methName)), ",")
|
||||
g.P("}")
|
||||
g.P("handler := func(ctx ", contextPkg, ".Context, req interface{}) (interface{}, error) {")
|
||||
g.P("return srv.(", servName, "Server).", methName, "(ctx, req.(*", inType, "))")
|
||||
g.P("}")
|
||||
g.P("return interceptor(ctx, in, info, handler)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
return hname
|
||||
}
|
||||
streamType := unexport(servName) + methName + "Server"
|
||||
g.P("func ", hname, "(srv interface{}, stream ", grpcPkg, ".ServerStream) error {")
|
||||
if !method.GetClientStreaming() {
|
||||
g.P("m := new(", inType, ")")
|
||||
g.P("if err := stream.RecvMsg(m); err != nil { return err }")
|
||||
g.P("return srv.(", servName, "Server).", methName, "(m, &", streamType, "{stream})")
|
||||
} else {
|
||||
g.P("return srv.(", servName, "Server).", methName, "(&", streamType, "{stream})")
|
||||
}
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
genSend := method.GetServerStreaming()
|
||||
genSendAndClose := !method.GetServerStreaming()
|
||||
genRecv := method.GetClientStreaming()
|
||||
|
||||
// Stream auxiliary types and methods.
|
||||
g.P("type ", servName, "_", methName, "Server interface {")
|
||||
if genSend {
|
||||
g.P("Send(*", outType, ") error")
|
||||
}
|
||||
if genSendAndClose {
|
||||
g.P("SendAndClose(*", outType, ") error")
|
||||
}
|
||||
if genRecv {
|
||||
g.P("Recv() (*", inType, ", error)")
|
||||
}
|
||||
g.P(grpcPkg, ".ServerStream")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
g.P("type ", streamType, " struct {")
|
||||
g.P(grpcPkg, ".ServerStream")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
if genSend {
|
||||
g.P("func (x *", streamType, ") Send(m *", outType, ") error {")
|
||||
g.P("return x.ServerStream.SendMsg(m)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
if genSendAndClose {
|
||||
g.P("func (x *", streamType, ") SendAndClose(m *", outType, ") error {")
|
||||
g.P("return x.ServerStream.SendMsg(m)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
if genRecv {
|
||||
g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {")
|
||||
g.P("m := new(", inType, ")")
|
||||
g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }")
|
||||
g.P("return m, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
return hname
|
||||
}
|
34
vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go
generated
vendored
Normal file
34
vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package main
|
||||
|
||||
import _ "github.com/golang/protobuf/protoc-gen-go/grpc"
|
98
vendor/github.com/golang/protobuf/protoc-gen-go/main.go
generated
vendored
Normal file
98
vendor/github.com/golang/protobuf/protoc-gen-go/main.go
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate
|
||||
// Go code. Run it by building this program and putting it in your path with
|
||||
// the name
|
||||
// protoc-gen-go
|
||||
// That word 'go' at the end becomes part of the option string set for the
|
||||
// protocol compiler, so once the protocol compiler (protoc) is installed
|
||||
// you can run
|
||||
// protoc --go_out=output_directory input_directory/file.proto
|
||||
// to generate Go bindings for the protocol defined by file.proto.
|
||||
// With that input, the output will be written to
|
||||
// output_directory/file.pb.go
|
||||
//
|
||||
// The generated code is documented in the package comment for
|
||||
// the library.
|
||||
//
|
||||
// See the README and documentation for protocol buffers to learn more:
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/protoc-gen-go/generator"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Begin by allocating a generator. The request and response structures are stored there
|
||||
// so we can do error handling easily - the response structure contains the field to
|
||||
// report failure.
|
||||
g := generator.New()
|
||||
|
||||
data, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
g.Error(err, "reading input")
|
||||
}
|
||||
|
||||
if err := proto.Unmarshal(data, g.Request); err != nil {
|
||||
g.Error(err, "parsing input proto")
|
||||
}
|
||||
|
||||
if len(g.Request.FileToGenerate) == 0 {
|
||||
g.Fail("no files to generate")
|
||||
}
|
||||
|
||||
g.CommandLineParameters(g.Request.GetParameter())
|
||||
|
||||
// Create a wrapped version of the Descriptors and EnumDescriptors that
|
||||
// point to the file that defines them.
|
||||
g.WrapTypes()
|
||||
|
||||
g.SetPackageNames()
|
||||
g.BuildTypeNameMap()
|
||||
|
||||
g.GenerateAllFiles()
|
||||
|
||||
// Send back the results.
|
||||
data, err = proto.Marshal(g.Response)
|
||||
if err != nil {
|
||||
g.Error(err, "failed to marshal output proto")
|
||||
}
|
||||
_, err = os.Stdout.Write(data)
|
||||
if err != nil {
|
||||
g.Error(err, "failed to write output proto")
|
||||
}
|
||||
}
|
44
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile
generated
vendored
Normal file
44
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Not stored here, but plugin.proto is in https://github.com/google/protobuf/
|
||||
# at src/google/protobuf/compiler/plugin.proto
|
||||
# Also we need to fix an import.
|
||||
regenerate:
|
||||
@echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION
|
||||
protoc --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor:../../../../.. \
|
||||
-I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto
|
||||
|
||||
restore:
|
||||
cp plugin.pb.golden plugin.pb.go
|
||||
|
||||
preserve:
|
||||
cp plugin.pb.go plugin.pb.golden
|
293
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go
generated
vendored
Normal file
293
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,293 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/protobuf/compiler/plugin.proto
|
||||
|
||||
/*
|
||||
Package plugin_go is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google/protobuf/compiler/plugin.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Version
|
||||
CodeGeneratorRequest
|
||||
CodeGeneratorResponse
|
||||
*/
|
||||
package plugin_go
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// The version number of protocol compiler.
|
||||
type Version struct {
|
||||
Major *int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
|
||||
Minor *int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"`
|
||||
Patch *int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"`
|
||||
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
||||
// be empty for mainline stable releases.
|
||||
Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Version) Reset() { *m = Version{} }
|
||||
func (m *Version) String() string { return proto.CompactTextString(m) }
|
||||
func (*Version) ProtoMessage() {}
|
||||
func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *Version) GetMajor() int32 {
|
||||
if m != nil && m.Major != nil {
|
||||
return *m.Major
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Version) GetMinor() int32 {
|
||||
if m != nil && m.Minor != nil {
|
||||
return *m.Minor
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Version) GetPatch() int32 {
|
||||
if m != nil && m.Patch != nil {
|
||||
return *m.Patch
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Version) GetSuffix() string {
|
||||
if m != nil && m.Suffix != nil {
|
||||
return *m.Suffix
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
||||
type CodeGeneratorRequest struct {
|
||||
// The .proto files that were explicitly listed on the command-line. The
|
||||
// code generator should generate code only for these files. Each file's
|
||||
// descriptor will be included in proto_file, below.
|
||||
FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"`
|
||||
// The generator parameter passed on the command-line.
|
||||
Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
|
||||
// FileDescriptorProtos for all files in files_to_generate and everything
|
||||
// they import. The files will appear in topological order, so each file
|
||||
// appears before any file that imports it.
|
||||
//
|
||||
// protoc guarantees that all proto_files will be written after
|
||||
// the fields above, even though this is not technically guaranteed by the
|
||||
// protobuf wire format. This theoretically could allow a plugin to stream
|
||||
// in the FileDescriptorProtos and handle them one by one rather than read
|
||||
// the entire set into memory at once. However, as of this writing, this
|
||||
// is not similarly optimized on protoc's end -- it will store all fields in
|
||||
// memory at once before sending them to the plugin.
|
||||
//
|
||||
// Type names of fields and extensions in the FileDescriptorProto are always
|
||||
// fully qualified.
|
||||
ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"`
|
||||
// The version number of protocol compiler.
|
||||
CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} }
|
||||
func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CodeGeneratorRequest) ProtoMessage() {}
|
||||
func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *CodeGeneratorRequest) GetFileToGenerate() []string {
|
||||
if m != nil {
|
||||
return m.FileToGenerate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorRequest) GetParameter() string {
|
||||
if m != nil && m.Parameter != nil {
|
||||
return *m.Parameter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto {
|
||||
if m != nil {
|
||||
return m.ProtoFile
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorRequest) GetCompilerVersion() *Version {
|
||||
if m != nil {
|
||||
return m.CompilerVersion
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
||||
type CodeGeneratorResponse struct {
|
||||
// Error message. If non-empty, code generation failed. The plugin process
|
||||
// should exit with status code zero even if it reports an error in this way.
|
||||
//
|
||||
// This should be used to indicate errors in .proto files which prevent the
|
||||
// code generator from generating correct code. Errors which indicate a
|
||||
// problem in protoc itself -- such as the input CodeGeneratorRequest being
|
||||
// unparseable -- should be reported by writing a message to stderr and
|
||||
// exiting with a non-zero status code.
|
||||
Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
|
||||
File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} }
|
||||
func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CodeGeneratorResponse) ProtoMessage() {}
|
||||
func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *CodeGeneratorResponse) GetError() string {
|
||||
if m != nil && m.Error != nil {
|
||||
return *m.Error
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {
|
||||
if m != nil {
|
||||
return m.File
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Represents a single generated file.
|
||||
type CodeGeneratorResponse_File struct {
|
||||
// The file name, relative to the output directory. The name must not
|
||||
// contain "." or ".." components and must be relative, not be absolute (so,
|
||||
// the file cannot lie outside the output directory). "/" must be used as
|
||||
// the path separator, not "\".
|
||||
//
|
||||
// If the name is omitted, the content will be appended to the previous
|
||||
// file. This allows the generator to break large files into small chunks,
|
||||
// and allows the generated text to be streamed back to protoc so that large
|
||||
// files need not reside completely in memory at one time. Note that as of
|
||||
// this writing protoc does not optimize for this -- it will read the entire
|
||||
// CodeGeneratorResponse before writing files to disk.
|
||||
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// If non-empty, indicates that the named file should already exist, and the
|
||||
// content here is to be inserted into that file at a defined insertion
|
||||
// point. This feature allows a code generator to extend the output
|
||||
// produced by another code generator. The original generator may provide
|
||||
// insertion points by placing special annotations in the file that look
|
||||
// like:
|
||||
// @@protoc_insertion_point(NAME)
|
||||
// The annotation can have arbitrary text before and after it on the line,
|
||||
// which allows it to be placed in a comment. NAME should be replaced with
|
||||
// an identifier naming the point -- this is what other generators will use
|
||||
// as the insertion_point. Code inserted at this point will be placed
|
||||
// immediately above the line containing the insertion point (thus multiple
|
||||
// insertions to the same point will come out in the order they were added).
|
||||
// The double-@ is intended to make it unlikely that the generated code
|
||||
// could contain things that look like insertion points by accident.
|
||||
//
|
||||
// For example, the C++ code generator places the following line in the
|
||||
// .pb.h files that it generates:
|
||||
// // @@protoc_insertion_point(namespace_scope)
|
||||
// This line appears within the scope of the file's package namespace, but
|
||||
// outside of any particular class. Another plugin can then specify the
|
||||
// insertion_point "namespace_scope" to generate additional classes or
|
||||
// other declarations that should be placed in this scope.
|
||||
//
|
||||
// Note that if the line containing the insertion point begins with
|
||||
// whitespace, the same whitespace will be added to every line of the
|
||||
// inserted text. This is useful for languages like Python, where
|
||||
// indentation matters. In these languages, the insertion point comment
|
||||
// should be indented the same amount as any inserted code will need to be
|
||||
// in order to work correctly in that context.
|
||||
//
|
||||
// The code generator that generates the initial file and the one which
|
||||
// inserts into it must both run as part of a single invocation of protoc.
|
||||
// Code generators are executed in the order in which they appear on the
|
||||
// command line.
|
||||
//
|
||||
// If |insertion_point| is present, |name| must also be present.
|
||||
InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"`
|
||||
// The file contents.
|
||||
Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} }
|
||||
func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) }
|
||||
func (*CodeGeneratorResponse_File) ProtoMessage() {}
|
||||
func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
|
||||
|
||||
func (m *CodeGeneratorResponse_File) GetName() string {
|
||||
if m != nil && m.Name != nil {
|
||||
return *m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorResponse_File) GetInsertionPoint() string {
|
||||
if m != nil && m.InsertionPoint != nil {
|
||||
return *m.InsertionPoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CodeGeneratorResponse_File) GetContent() string {
|
||||
if m != nil && m.Content != nil {
|
||||
return *m.Content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Version)(nil), "google.protobuf.compiler.Version")
|
||||
proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest")
|
||||
proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse")
|
||||
proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/compiler/plugin.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 417 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x6a, 0x14, 0x41,
|
||||
0x10, 0xc6, 0x19, 0x77, 0x63, 0x98, 0x8a, 0x64, 0x43, 0x13, 0xa5, 0x09, 0x39, 0x8c, 0x8b, 0xe2,
|
||||
0x5c, 0x32, 0x0b, 0xc1, 0x8b, 0x78, 0x4b, 0x44, 0x3d, 0x78, 0x58, 0x1a, 0xf1, 0x20, 0xc8, 0x30,
|
||||
0x99, 0xd4, 0x74, 0x5a, 0x66, 0xba, 0xc6, 0xee, 0x1e, 0xf1, 0x49, 0x7d, 0x0f, 0xdf, 0x40, 0xfa,
|
||||
0xcf, 0x24, 0xb2, 0xb8, 0xa7, 0xee, 0xef, 0x57, 0xd5, 0xd5, 0x55, 0x1f, 0x05, 0x2f, 0x25, 0x91,
|
||||
0xec, 0x71, 0x33, 0x1a, 0x72, 0x74, 0x33, 0x75, 0x9b, 0x96, 0x86, 0x51, 0xf5, 0x68, 0x36, 0x63,
|
||||
0x3f, 0x49, 0xa5, 0xab, 0x10, 0x60, 0x3c, 0xa6, 0x55, 0x73, 0x5a, 0x35, 0xa7, 0x9d, 0x15, 0xbb,
|
||||
0x05, 0x6e, 0xd1, 0xb6, 0x46, 0x8d, 0x8e, 0x4c, 0xcc, 0x5e, 0xb7, 0x70, 0xf8, 0x05, 0x8d, 0x55,
|
||||
0xa4, 0xd9, 0x29, 0x1c, 0x0c, 0xcd, 0x77, 0x32, 0x3c, 0x2b, 0xb2, 0xf2, 0x40, 0x44, 0x11, 0xa8,
|
||||
0xd2, 0x64, 0xf8, 0xa3, 0x44, 0xbd, 0xf0, 0x74, 0x6c, 0x5c, 0x7b, 0xc7, 0x17, 0x91, 0x06, 0xc1,
|
||||
0x9e, 0xc1, 0x63, 0x3b, 0x75, 0x9d, 0xfa, 0xc5, 0x97, 0x45, 0x56, 0xe6, 0x22, 0xa9, 0xf5, 0x9f,
|
||||
0x0c, 0x4e, 0xaf, 0xe9, 0x16, 0x3f, 0xa0, 0x46, 0xd3, 0x38, 0x32, 0x02, 0x7f, 0x4c, 0x68, 0x1d,
|
||||
0x2b, 0xe1, 0xa4, 0x53, 0x3d, 0xd6, 0x8e, 0x6a, 0x19, 0x63, 0xc8, 0xb3, 0x62, 0x51, 0xe6, 0xe2,
|
||||
0xd8, 0xf3, 0xcf, 0x94, 0x5e, 0x20, 0x3b, 0x87, 0x7c, 0x6c, 0x4c, 0x33, 0xa0, 0xc3, 0xd8, 0x4a,
|
||||
0x2e, 0x1e, 0x00, 0xbb, 0x06, 0x08, 0xe3, 0xd4, 0xfe, 0x15, 0x5f, 0x15, 0x8b, 0xf2, 0xe8, 0xf2,
|
||||
0x45, 0xb5, 0x6b, 0xcb, 0x7b, 0xd5, 0xe3, 0xbb, 0x7b, 0x03, 0xb6, 0x1e, 0x8b, 0x3c, 0x44, 0x7d,
|
||||
0x84, 0x7d, 0x82, 0x93, 0xd9, 0xb8, 0xfa, 0x67, 0xf4, 0x24, 0x8c, 0x77, 0x74, 0xf9, 0xbc, 0xda,
|
||||
0xe7, 0x70, 0x95, 0xcc, 0x13, 0xab, 0x99, 0x24, 0xb0, 0xfe, 0x9d, 0xc1, 0xd3, 0x9d, 0x99, 0xed,
|
||||
0x48, 0xda, 0xa2, 0xf7, 0x0e, 0x8d, 0x49, 0x3e, 0xe7, 0x22, 0x0a, 0xf6, 0x11, 0x96, 0xff, 0x34,
|
||||
0xff, 0x7a, 0xff, 0x8f, 0xff, 0x2d, 0x1a, 0x66, 0x13, 0xa1, 0xc2, 0xd9, 0x37, 0x58, 0x86, 0x79,
|
||||
0x18, 0x2c, 0x75, 0x33, 0x60, 0xfa, 0x26, 0xdc, 0xd9, 0x2b, 0x58, 0x29, 0x6d, 0xd1, 0x38, 0x45,
|
||||
0xba, 0x1e, 0x49, 0x69, 0x97, 0xcc, 0x3c, 0xbe, 0xc7, 0x5b, 0x4f, 0x19, 0x87, 0xc3, 0x96, 0xb4,
|
||||
0x43, 0xed, 0xf8, 0x2a, 0x24, 0xcc, 0xf2, 0x4a, 0xc2, 0x79, 0x4b, 0xc3, 0xde, 0xfe, 0xae, 0x9e,
|
||||
0x6c, 0xc3, 0x6e, 0x06, 0x7b, 0xed, 0xd7, 0x37, 0x52, 0xb9, 0xbb, 0xe9, 0xc6, 0x87, 0x37, 0x92,
|
||||
0xfa, 0x46, 0xcb, 0x87, 0x65, 0x0c, 0x97, 0xf6, 0x42, 0xa2, 0xbe, 0x90, 0x94, 0x56, 0xfa, 0x6d,
|
||||
0x3c, 0x6a, 0x49, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x15, 0x40, 0xc5, 0xfe, 0x02, 0x00,
|
||||
0x00,
|
||||
}
|
83
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden
generated
vendored
Normal file
83
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/compiler/plugin.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf_compiler
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import "math"
|
||||
import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||
|
||||
// Reference proto and math imports to suppress error if they are not otherwise used.
|
||||
var _ = proto.GetString
|
||||
var _ = math.Inf
|
||||
|
||||
type CodeGeneratorRequest struct {
|
||||
FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"`
|
||||
Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
|
||||
ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (this *CodeGeneratorRequest) Reset() { *this = CodeGeneratorRequest{} }
|
||||
func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }
|
||||
func (*CodeGeneratorRequest) ProtoMessage() {}
|
||||
|
||||
func (this *CodeGeneratorRequest) GetParameter() string {
|
||||
if this != nil && this.Parameter != nil {
|
||||
return *this.Parameter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CodeGeneratorResponse struct {
|
||||
Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
|
||||
File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (this *CodeGeneratorResponse) Reset() { *this = CodeGeneratorResponse{} }
|
||||
func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }
|
||||
func (*CodeGeneratorResponse) ProtoMessage() {}
|
||||
|
||||
func (this *CodeGeneratorResponse) GetError() string {
|
||||
if this != nil && this.Error != nil {
|
||||
return *this.Error
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CodeGeneratorResponse_File struct {
|
||||
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"`
|
||||
Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (this *CodeGeneratorResponse_File) Reset() { *this = CodeGeneratorResponse_File{} }
|
||||
func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }
|
||||
func (*CodeGeneratorResponse_File) ProtoMessage() {}
|
||||
|
||||
func (this *CodeGeneratorResponse_File) GetName() string {
|
||||
if this != nil && this.Name != nil {
|
||||
return *this.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (this *CodeGeneratorResponse_File) GetInsertionPoint() string {
|
||||
if this != nil && this.InsertionPoint != nil {
|
||||
return *this.InsertionPoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (this *CodeGeneratorResponse_File) GetContent() string {
|
||||
if this != nil && this.Content != nil {
|
||||
return *this.Content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
}
|
73
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile
generated
vendored
Normal file
73
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
all:
|
||||
@echo run make test
|
||||
|
||||
include ../../Make.protobuf
|
||||
|
||||
test: golden testbuild
|
||||
|
||||
#test: golden testbuild extension_test
|
||||
# ./extension_test
|
||||
# @echo PASS
|
||||
|
||||
my_test/test.pb.go: my_test/test.proto
|
||||
protoc --go_out=Mmulti/multi1.proto=github.com/golang/protobuf/protoc-gen-go/testdata/multi:. $<
|
||||
|
||||
golden:
|
||||
make -B my_test/test.pb.go
|
||||
sed -i -e '/return.*fileDescriptor/d' my_test/test.pb.go
|
||||
sed -i -e '/^var fileDescriptor/,/^}/d' my_test/test.pb.go
|
||||
sed -i -e '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go
|
||||
gofmt -w my_test/test.pb.go
|
||||
diff -w my_test/test.pb.go my_test/test.pb.go.golden
|
||||
|
||||
nuke: clean
|
||||
|
||||
testbuild: regenerate
|
||||
go test
|
||||
|
||||
regenerate:
|
||||
# Invoke protoc once to generate three independent .pb.go files in the same package.
|
||||
protoc --go_out=. multi/multi1.proto multi/multi2.proto multi/multi3.proto
|
||||
|
||||
#extension_test: extension_test.$O
|
||||
# $(LD) -L. -o $@ $<
|
||||
|
||||
#multi.a: multi3.pb.$O multi2.pb.$O multi1.pb.$O
|
||||
# rm -f multi.a
|
||||
# $(QUOTED_GOBIN)/gopack grc $@ $<
|
||||
|
||||
#test.pb.go: imp.pb.go
|
||||
#multi1.pb.go: multi2.pb.go multi3.pb.go
|
||||
#main.$O: imp.pb.$O test.pb.$O multi.a
|
||||
#extension_test.$O: extension_base.pb.$O extension_extra.pb.$O extension_user.pb.$O
|
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto
generated
vendored
Normal file
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package extension_base;
|
||||
|
||||
message BaseMessage {
|
||||
optional int32 height = 1;
|
||||
extensions 4 to 9;
|
||||
extensions 16 to max;
|
||||
}
|
||||
|
||||
// Another message that may be extended, using message_set_wire_format.
|
||||
message OldStyleMessage {
|
||||
option message_set_wire_format = true;
|
||||
extensions 100 to max;
|
||||
}
|
38
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto
generated
vendored
Normal file
38
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package extension_extra;
|
||||
|
||||
message ExtraMessage {
|
||||
optional int32 width = 1;
|
||||
}
|
210
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_test.go
generated
vendored
Normal file
210
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_test.go
generated
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Test that we can use protocol buffers that use extensions.
|
||||
|
||||
package testdata
|
||||
|
||||
/*
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
base "extension_base.pb"
|
||||
user "extension_user.pb"
|
||||
)
|
||||
|
||||
func TestSingleFieldExtension(t *testing.T) {
|
||||
bm := &base.BaseMessage{
|
||||
Height: proto.Int32(178),
|
||||
}
|
||||
|
||||
// Use extension within scope of another type.
|
||||
vol := proto.Uint32(11)
|
||||
err := proto.SetExtension(bm, user.E_LoudMessage_Volume, vol)
|
||||
if err != nil {
|
||||
t.Fatal("Failed setting extension:", err)
|
||||
}
|
||||
buf, err := proto.Marshal(bm)
|
||||
if err != nil {
|
||||
t.Fatal("Failed encoding message with extension:", err)
|
||||
}
|
||||
bm_new := new(base.BaseMessage)
|
||||
if err := proto.Unmarshal(buf, bm_new); err != nil {
|
||||
t.Fatal("Failed decoding message with extension:", err)
|
||||
}
|
||||
if !proto.HasExtension(bm_new, user.E_LoudMessage_Volume) {
|
||||
t.Fatal("Decoded message didn't contain extension.")
|
||||
}
|
||||
vol_out, err := proto.GetExtension(bm_new, user.E_LoudMessage_Volume)
|
||||
if err != nil {
|
||||
t.Fatal("Failed getting extension:", err)
|
||||
}
|
||||
if v := vol_out.(*uint32); *v != *vol {
|
||||
t.Errorf("vol_out = %v, expected %v", *v, *vol)
|
||||
}
|
||||
proto.ClearExtension(bm_new, user.E_LoudMessage_Volume)
|
||||
if proto.HasExtension(bm_new, user.E_LoudMessage_Volume) {
|
||||
t.Fatal("Failed clearing extension.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageExtension(t *testing.T) {
|
||||
bm := &base.BaseMessage{
|
||||
Height: proto.Int32(179),
|
||||
}
|
||||
|
||||
// Use extension that is itself a message.
|
||||
um := &user.UserMessage{
|
||||
Name: proto.String("Dave"),
|
||||
Rank: proto.String("Major"),
|
||||
}
|
||||
err := proto.SetExtension(bm, user.E_LoginMessage_UserMessage, um)
|
||||
if err != nil {
|
||||
t.Fatal("Failed setting extension:", err)
|
||||
}
|
||||
buf, err := proto.Marshal(bm)
|
||||
if err != nil {
|
||||
t.Fatal("Failed encoding message with extension:", err)
|
||||
}
|
||||
bm_new := new(base.BaseMessage)
|
||||
if err := proto.Unmarshal(buf, bm_new); err != nil {
|
||||
t.Fatal("Failed decoding message with extension:", err)
|
||||
}
|
||||
if !proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) {
|
||||
t.Fatal("Decoded message didn't contain extension.")
|
||||
}
|
||||
um_out, err := proto.GetExtension(bm_new, user.E_LoginMessage_UserMessage)
|
||||
if err != nil {
|
||||
t.Fatal("Failed getting extension:", err)
|
||||
}
|
||||
if n := um_out.(*user.UserMessage).Name; *n != *um.Name {
|
||||
t.Errorf("um_out.Name = %q, expected %q", *n, *um.Name)
|
||||
}
|
||||
if r := um_out.(*user.UserMessage).Rank; *r != *um.Rank {
|
||||
t.Errorf("um_out.Rank = %q, expected %q", *r, *um.Rank)
|
||||
}
|
||||
proto.ClearExtension(bm_new, user.E_LoginMessage_UserMessage)
|
||||
if proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) {
|
||||
t.Fatal("Failed clearing extension.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTopLevelExtension(t *testing.T) {
|
||||
bm := &base.BaseMessage{
|
||||
Height: proto.Int32(179),
|
||||
}
|
||||
|
||||
width := proto.Int32(17)
|
||||
err := proto.SetExtension(bm, user.E_Width, width)
|
||||
if err != nil {
|
||||
t.Fatal("Failed setting extension:", err)
|
||||
}
|
||||
buf, err := proto.Marshal(bm)
|
||||
if err != nil {
|
||||
t.Fatal("Failed encoding message with extension:", err)
|
||||
}
|
||||
bm_new := new(base.BaseMessage)
|
||||
if err := proto.Unmarshal(buf, bm_new); err != nil {
|
||||
t.Fatal("Failed decoding message with extension:", err)
|
||||
}
|
||||
if !proto.HasExtension(bm_new, user.E_Width) {
|
||||
t.Fatal("Decoded message didn't contain extension.")
|
||||
}
|
||||
width_out, err := proto.GetExtension(bm_new, user.E_Width)
|
||||
if err != nil {
|
||||
t.Fatal("Failed getting extension:", err)
|
||||
}
|
||||
if w := width_out.(*int32); *w != *width {
|
||||
t.Errorf("width_out = %v, expected %v", *w, *width)
|
||||
}
|
||||
proto.ClearExtension(bm_new, user.E_Width)
|
||||
if proto.HasExtension(bm_new, user.E_Width) {
|
||||
t.Fatal("Failed clearing extension.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageSetWireFormat(t *testing.T) {
|
||||
osm := new(base.OldStyleMessage)
|
||||
osp := &user.OldStyleParcel{
|
||||
Name: proto.String("Dave"),
|
||||
Height: proto.Int32(178),
|
||||
}
|
||||
|
||||
err := proto.SetExtension(osm, user.E_OldStyleParcel_MessageSetExtension, osp)
|
||||
if err != nil {
|
||||
t.Fatal("Failed setting extension:", err)
|
||||
}
|
||||
|
||||
buf, err := proto.Marshal(osm)
|
||||
if err != nil {
|
||||
t.Fatal("Failed encoding message:", err)
|
||||
}
|
||||
|
||||
// Data generated from Python implementation.
|
||||
expected := []byte{
|
||||
11, 16, 209, 15, 26, 9, 10, 4, 68, 97, 118, 101, 16, 178, 1, 12,
|
||||
}
|
||||
|
||||
if !bytes.Equal(expected, buf) {
|
||||
t.Errorf("Encoding mismatch.\nwant %+v\n got %+v", expected, buf)
|
||||
}
|
||||
|
||||
// Check that it is restored correctly.
|
||||
osm = new(base.OldStyleMessage)
|
||||
if err := proto.Unmarshal(buf, osm); err != nil {
|
||||
t.Fatal("Failed decoding message:", err)
|
||||
}
|
||||
osp_out, err := proto.GetExtension(osm, user.E_OldStyleParcel_MessageSetExtension)
|
||||
if err != nil {
|
||||
t.Fatal("Failed getting extension:", err)
|
||||
}
|
||||
osp = osp_out.(*user.OldStyleParcel)
|
||||
if *osp.Name != "Dave" || *osp.Height != 178 {
|
||||
t.Errorf("Retrieved extension from decoded message is not correct: %+v", osp)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// simpler than rigging up gotest
|
||||
testing.Main(regexp.MatchString, []testing.InternalTest{
|
||||
{"TestSingleFieldExtension", TestSingleFieldExtension},
|
||||
{"TestMessageExtension", TestMessageExtension},
|
||||
{"TestTopLevelExtension", TestTopLevelExtension},
|
||||
},
|
||||
[]testing.InternalBenchmark{},
|
||||
[]testing.InternalExample{})
|
||||
}
|
||||
|
||||
*/
|
100
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto
generated
vendored
Normal file
100
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
import "extension_base.proto";
|
||||
import "extension_extra.proto";
|
||||
|
||||
package extension_user;
|
||||
|
||||
message UserMessage {
|
||||
optional string name = 1;
|
||||
optional string rank = 2;
|
||||
}
|
||||
|
||||
// Extend with a message
|
||||
extend extension_base.BaseMessage {
|
||||
optional UserMessage user_message = 5;
|
||||
}
|
||||
|
||||
// Extend with a foreign message
|
||||
extend extension_base.BaseMessage {
|
||||
optional extension_extra.ExtraMessage extra_message = 9;
|
||||
}
|
||||
|
||||
// Extend with some primitive types
|
||||
extend extension_base.BaseMessage {
|
||||
optional int32 width = 6;
|
||||
optional int64 area = 7;
|
||||
}
|
||||
|
||||
// Extend inside the scope of another type
|
||||
message LoudMessage {
|
||||
extend extension_base.BaseMessage {
|
||||
optional uint32 volume = 8;
|
||||
}
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
// Extend inside the scope of another type, using a message.
|
||||
message LoginMessage {
|
||||
extend extension_base.BaseMessage {
|
||||
optional UserMessage user_message = 16;
|
||||
}
|
||||
}
|
||||
|
||||
// Extend with a repeated field
|
||||
extend extension_base.BaseMessage {
|
||||
repeated Detail detail = 17;
|
||||
}
|
||||
|
||||
message Detail {
|
||||
optional string color = 1;
|
||||
}
|
||||
|
||||
// An extension of an extension
|
||||
message Announcement {
|
||||
optional string words = 1;
|
||||
extend LoudMessage {
|
||||
optional Announcement loud_ext = 100;
|
||||
}
|
||||
}
|
||||
|
||||
// Something that can be put in a message set.
|
||||
message OldStyleParcel {
|
||||
extend extension_base.OldStyleMessage {
|
||||
optional OldStyleParcel message_set_extension = 2001;
|
||||
}
|
||||
|
||||
required string name = 1;
|
||||
optional int32 height = 2;
|
||||
}
|
59
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto
generated
vendored
Normal file
59
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
message SimpleRequest {
|
||||
}
|
||||
|
||||
message SimpleResponse {
|
||||
}
|
||||
|
||||
message StreamMsg {
|
||||
}
|
||||
|
||||
message StreamMsg2 {
|
||||
}
|
||||
|
||||
service Test {
|
||||
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
|
||||
|
||||
// This RPC streams from the server only.
|
||||
rpc Downstream(SimpleRequest) returns (stream StreamMsg);
|
||||
|
||||
// This RPC streams from the client.
|
||||
rpc Upstream(stream StreamMsg) returns (SimpleResponse);
|
||||
|
||||
// This one streams in both directions.
|
||||
rpc Bidi(stream StreamMsg) returns (stream StreamMsg2);
|
||||
}
|
113
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden
generated
vendored
Normal file
113
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: imp.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package imp
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import "math"
|
||||
import "os"
|
||||
import imp1 "imp2.pb"
|
||||
|
||||
// Reference proto & math imports to suppress error if they are not otherwise used.
|
||||
var _ = proto.GetString
|
||||
var _ = math.Inf
|
||||
|
||||
// Types from public import imp2.proto
|
||||
type PubliclyImportedMessage imp1.PubliclyImportedMessage
|
||||
|
||||
func (this *PubliclyImportedMessage) Reset() { (*imp1.PubliclyImportedMessage)(this).Reset() }
|
||||
func (this *PubliclyImportedMessage) String() string {
|
||||
return (*imp1.PubliclyImportedMessage)(this).String()
|
||||
}
|
||||
|
||||
// PubliclyImportedMessage from public import imp.proto
|
||||
|
||||
type ImportedMessage_Owner int32
|
||||
|
||||
const (
|
||||
ImportedMessage_DAVE ImportedMessage_Owner = 1
|
||||
ImportedMessage_MIKE ImportedMessage_Owner = 2
|
||||
)
|
||||
|
||||
var ImportedMessage_Owner_name = map[int32]string{
|
||||
1: "DAVE",
|
||||
2: "MIKE",
|
||||
}
|
||||
var ImportedMessage_Owner_value = map[string]int32{
|
||||
"DAVE": 1,
|
||||
"MIKE": 2,
|
||||
}
|
||||
|
||||
// NewImportedMessage_Owner is deprecated. Use x.Enum() instead.
|
||||
func NewImportedMessage_Owner(x ImportedMessage_Owner) *ImportedMessage_Owner {
|
||||
e := ImportedMessage_Owner(x)
|
||||
return &e
|
||||
}
|
||||
func (x ImportedMessage_Owner) Enum() *ImportedMessage_Owner {
|
||||
p := new(ImportedMessage_Owner)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x ImportedMessage_Owner) String() string {
|
||||
return proto.EnumName(ImportedMessage_Owner_name, int32(x))
|
||||
}
|
||||
|
||||
type ImportedMessage struct {
|
||||
Field *int64 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
|
||||
XXX_extensions map[int32][]byte `json:",omitempty"`
|
||||
XXX_unrecognized []byte `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (this *ImportedMessage) Reset() { *this = ImportedMessage{} }
|
||||
func (this *ImportedMessage) String() string { return proto.CompactTextString(this) }
|
||||
|
||||
var extRange_ImportedMessage = []proto.ExtensionRange{
|
||||
proto.ExtensionRange{90, 100},
|
||||
}
|
||||
|
||||
func (*ImportedMessage) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_ImportedMessage
|
||||
}
|
||||
func (this *ImportedMessage) ExtensionMap() map[int32][]byte {
|
||||
if this.XXX_extensions == nil {
|
||||
this.XXX_extensions = make(map[int32][]byte)
|
||||
}
|
||||
return this.XXX_extensions
|
||||
}
|
||||
|
||||
type ImportedExtendable struct {
|
||||
XXX_extensions map[int32][]byte `json:",omitempty"`
|
||||
XXX_unrecognized []byte `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (this *ImportedExtendable) Reset() { *this = ImportedExtendable{} }
|
||||
func (this *ImportedExtendable) String() string { return proto.CompactTextString(this) }
|
||||
|
||||
func (this *ImportedExtendable) Marshal() ([]byte, error) {
|
||||
return proto.MarshalMessageSet(this.ExtensionMap())
|
||||
}
|
||||
func (this *ImportedExtendable) Unmarshal(buf []byte) error {
|
||||
return proto.UnmarshalMessageSet(buf, this.ExtensionMap())
|
||||
}
|
||||
// ensure ImportedExtendable satisfies proto.Marshaler and proto.Unmarshaler
|
||||
var _ proto.Marshaler = (*ImportedExtendable)(nil)
|
||||
var _ proto.Unmarshaler = (*ImportedExtendable)(nil)
|
||||
|
||||
var extRange_ImportedExtendable = []proto.ExtensionRange{
|
||||
proto.ExtensionRange{100, 536870911},
|
||||
}
|
||||
|
||||
func (*ImportedExtendable) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_ImportedExtendable
|
||||
}
|
||||
func (this *ImportedExtendable) ExtensionMap() map[int32][]byte {
|
||||
if this.XXX_extensions == nil {
|
||||
this.XXX_extensions = make(map[int32][]byte)
|
||||
}
|
||||
return this.XXX_extensions
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("imp.ImportedMessage_Owner", ImportedMessage_Owner_name, ImportedMessage_Owner_value)
|
||||
}
|
70
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto
generated
vendored
Normal file
70
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package imp;
|
||||
|
||||
import "imp2.proto";
|
||||
import "imp3.proto";
|
||||
|
||||
message ImportedMessage {
|
||||
required int64 field = 1;
|
||||
|
||||
// The forwarded getters for these fields are fiddly to get right.
|
||||
optional ImportedMessage2 local_msg = 2;
|
||||
optional ForeignImportedMessage foreign_msg = 3; // in imp3.proto
|
||||
optional Owner enum_field = 4;
|
||||
oneof union {
|
||||
int32 state = 9;
|
||||
}
|
||||
|
||||
repeated string name = 5;
|
||||
repeated Owner boss = 6;
|
||||
repeated ImportedMessage2 memo = 7;
|
||||
|
||||
map<string, ImportedMessage2> msg_map = 8;
|
||||
|
||||
enum Owner {
|
||||
DAVE = 1;
|
||||
MIKE = 2;
|
||||
}
|
||||
|
||||
extensions 90 to 100;
|
||||
}
|
||||
|
||||
message ImportedMessage2 {
|
||||
}
|
||||
|
||||
message ImportedExtendable {
|
||||
option message_set_wire_format = true;
|
||||
extensions 100 to max;
|
||||
}
|
43
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto
generated
vendored
Normal file
43
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package imp;
|
||||
|
||||
message PubliclyImportedMessage {
|
||||
optional int64 field = 1;
|
||||
}
|
||||
|
||||
enum PubliclyImportedEnum {
|
||||
GLASSES = 1;
|
||||
HAIR = 2;
|
||||
}
|
38
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto
generated
vendored
Normal file
38
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package imp;
|
||||
|
||||
message ForeignImportedMessage {
|
||||
optional string tuber = 1;
|
||||
}
|
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/main_test.go
generated
vendored
Normal file
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/main_test.go
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// A simple binary to link together the protocol buffers in this test.
|
||||
|
||||
package testdata
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
mytestpb "./my_test"
|
||||
multipb "github.com/golang/protobuf/protoc-gen-go/testdata/multi"
|
||||
)
|
||||
|
||||
func TestLink(t *testing.T) {
|
||||
_ = &multipb.Multi1{}
|
||||
_ = &mytestpb.Request{}
|
||||
}
|
44
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto
generated
vendored
Normal file
44
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
import "multi/multi2.proto";
|
||||
import "multi/multi3.proto";
|
||||
|
||||
package multitest;
|
||||
|
||||
message Multi1 {
|
||||
required Multi2 multi2 = 1;
|
||||
optional Multi2.Color color = 2;
|
||||
optional Multi3.HatType hat_type = 3;
|
||||
}
|
||||
|
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto
generated
vendored
Normal file
46
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package multitest;
|
||||
|
||||
message Multi2 {
|
||||
required int32 required_value = 1;
|
||||
|
||||
enum Color {
|
||||
BLUE = 1;
|
||||
GREEN = 2;
|
||||
RED = 3;
|
||||
};
|
||||
optional Color color = 2;
|
||||
}
|
||||
|
43
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto
generated
vendored
Normal file
43
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package multitest;
|
||||
|
||||
message Multi3 {
|
||||
enum HatType {
|
||||
FEDORA = 1;
|
||||
FEZ = 2;
|
||||
};
|
||||
optional HatType hat_type = 1;
|
||||
}
|
||||
|
870
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
generated
vendored
Normal file
870
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,870 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: my_test/test.proto
|
||||
|
||||
/*
|
||||
Package my_test is a generated protocol buffer package.
|
||||
|
||||
This package holds interesting messages.
|
||||
|
||||
It is generated from these files:
|
||||
my_test/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Request
|
||||
Reply
|
||||
OtherBase
|
||||
ReplyExtensions
|
||||
OtherReplyExtensions
|
||||
OldReply
|
||||
Communique
|
||||
*/
|
||||
package my_test
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/golang/protobuf/protoc-gen-go/testdata/multi"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type HatType int32
|
||||
|
||||
const (
|
||||
// deliberately skipping 0
|
||||
HatType_FEDORA HatType = 1
|
||||
HatType_FEZ HatType = 2
|
||||
)
|
||||
|
||||
var HatType_name = map[int32]string{
|
||||
1: "FEDORA",
|
||||
2: "FEZ",
|
||||
}
|
||||
var HatType_value = map[string]int32{
|
||||
"FEDORA": 1,
|
||||
"FEZ": 2,
|
||||
}
|
||||
|
||||
func (x HatType) Enum() *HatType {
|
||||
p := new(HatType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x HatType) String() string {
|
||||
return proto.EnumName(HatType_name, int32(x))
|
||||
}
|
||||
func (x *HatType) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(HatType_value, data, "HatType")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = HatType(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
// This enum represents days of the week.
|
||||
type Days int32
|
||||
|
||||
const (
|
||||
Days_MONDAY Days = 1
|
||||
Days_TUESDAY Days = 2
|
||||
Days_LUNDI Days = 1
|
||||
)
|
||||
|
||||
var Days_name = map[int32]string{
|
||||
1: "MONDAY",
|
||||
2: "TUESDAY",
|
||||
// Duplicate value: 1: "LUNDI",
|
||||
}
|
||||
var Days_value = map[string]int32{
|
||||
"MONDAY": 1,
|
||||
"TUESDAY": 2,
|
||||
"LUNDI": 1,
|
||||
}
|
||||
|
||||
func (x Days) Enum() *Days {
|
||||
p := new(Days)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Days) String() string {
|
||||
return proto.EnumName(Days_name, int32(x))
|
||||
}
|
||||
func (x *Days) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Days_value, data, "Days")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Days(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Request_Color int32
|
||||
|
||||
const (
|
||||
Request_RED Request_Color = 0
|
||||
Request_GREEN Request_Color = 1
|
||||
Request_BLUE Request_Color = 2
|
||||
)
|
||||
|
||||
var Request_Color_name = map[int32]string{
|
||||
0: "RED",
|
||||
1: "GREEN",
|
||||
2: "BLUE",
|
||||
}
|
||||
var Request_Color_value = map[string]int32{
|
||||
"RED": 0,
|
||||
"GREEN": 1,
|
||||
"BLUE": 2,
|
||||
}
|
||||
|
||||
func (x Request_Color) Enum() *Request_Color {
|
||||
p := new(Request_Color)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Request_Color) String() string {
|
||||
return proto.EnumName(Request_Color_name, int32(x))
|
||||
}
|
||||
func (x *Request_Color) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Request_Color_value, data, "Request_Color")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Request_Color(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Reply_Entry_Game int32
|
||||
|
||||
const (
|
||||
Reply_Entry_FOOTBALL Reply_Entry_Game = 1
|
||||
Reply_Entry_TENNIS Reply_Entry_Game = 2
|
||||
)
|
||||
|
||||
var Reply_Entry_Game_name = map[int32]string{
|
||||
1: "FOOTBALL",
|
||||
2: "TENNIS",
|
||||
}
|
||||
var Reply_Entry_Game_value = map[string]int32{
|
||||
"FOOTBALL": 1,
|
||||
"TENNIS": 2,
|
||||
}
|
||||
|
||||
func (x Reply_Entry_Game) Enum() *Reply_Entry_Game {
|
||||
p := new(Reply_Entry_Game)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Reply_Entry_Game) String() string {
|
||||
return proto.EnumName(Reply_Entry_Game_name, int32(x))
|
||||
}
|
||||
func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, "Reply_Entry_Game")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Reply_Entry_Game(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
// This is a message that might be sent somewhere.
|
||||
type Request struct {
|
||||
Key []int64 `protobuf:"varint,1,rep,name=key" json:"key,omitempty"`
|
||||
// optional imp.ImportedMessage imported_message = 2;
|
||||
Hue *Request_Color `protobuf:"varint,3,opt,name=hue,enum=my.test.Request_Color" json:"hue,omitempty"`
|
||||
Hat *HatType `protobuf:"varint,4,opt,name=hat,enum=my.test.HatType,def=1" json:"hat,omitempty"`
|
||||
// optional imp.ImportedMessage.Owner owner = 6;
|
||||
Deadline *float32 `protobuf:"fixed32,7,opt,name=deadline,def=inf" json:"deadline,omitempty"`
|
||||
Somegroup *Request_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"`
|
||||
// This is a map field. It will generate map[int32]string.
|
||||
NameMapping map[int32]string `protobuf:"bytes,14,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// This is a map field whose value type is a message.
|
||||
MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"`
|
||||
// This field should not conflict with any getters.
|
||||
GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request) Reset() { *m = Request{} }
|
||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
|
||||
const Default_Request_Hat HatType = HatType_FEDORA
|
||||
|
||||
var Default_Request_Deadline float32 = float32(math.Inf(1))
|
||||
|
||||
func (m *Request) GetKey() []int64 {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetHue() Request_Color {
|
||||
if m != nil && m.Hue != nil {
|
||||
return *m.Hue
|
||||
}
|
||||
return Request_RED
|
||||
}
|
||||
|
||||
func (m *Request) GetHat() HatType {
|
||||
if m != nil && m.Hat != nil {
|
||||
return *m.Hat
|
||||
}
|
||||
return Default_Request_Hat
|
||||
}
|
||||
|
||||
func (m *Request) GetDeadline() float32 {
|
||||
if m != nil && m.Deadline != nil {
|
||||
return *m.Deadline
|
||||
}
|
||||
return Default_Request_Deadline
|
||||
}
|
||||
|
||||
func (m *Request) GetSomegroup() *Request_SomeGroup {
|
||||
if m != nil {
|
||||
return m.Somegroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetNameMapping() map[int32]string {
|
||||
if m != nil {
|
||||
return m.NameMapping
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetMsgMapping() map[int64]*Reply {
|
||||
if m != nil {
|
||||
return m.MsgMapping
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetReset_() int32 {
|
||||
if m != nil && m.Reset_ != nil {
|
||||
return *m.Reset_
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetGetKey_() string {
|
||||
if m != nil && m.GetKey_ != nil {
|
||||
return *m.GetKey_
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Request_SomeGroup struct {
|
||||
GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} }
|
||||
func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request_SomeGroup) ProtoMessage() {}
|
||||
|
||||
func (m *Request_SomeGroup) GetGroupField() int32 {
|
||||
if m != nil && m.GroupField != nil {
|
||||
return *m.GroupField
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Reply struct {
|
||||
Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"`
|
||||
CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Reply) Reset() { *m = Reply{} }
|
||||
func (m *Reply) String() string { return proto.CompactTextString(m) }
|
||||
func (*Reply) ProtoMessage() {}
|
||||
|
||||
var extRange_Reply = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*Reply) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Reply
|
||||
}
|
||||
|
||||
func (m *Reply) GetFound() []*Reply_Entry {
|
||||
if m != nil {
|
||||
return m.Found
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Reply) GetCompactKeys() []int32 {
|
||||
if m != nil {
|
||||
return m.CompactKeys
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Reply_Entry struct {
|
||||
KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"`
|
||||
Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"`
|
||||
XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
|
||||
func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
|
||||
func (*Reply_Entry) ProtoMessage() {}
|
||||
|
||||
const Default_Reply_Entry_Value int64 = 7
|
||||
|
||||
func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
|
||||
if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {
|
||||
return *m.KeyThatNeeds_1234Camel_CasIng
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) GetValue() int64 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return Default_Reply_Entry_Value
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) GetXMyFieldName_2() int64 {
|
||||
if m != nil && m.XMyFieldName_2 != nil {
|
||||
return *m.XMyFieldName_2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type OtherBase struct {
|
||||
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OtherBase) Reset() { *m = OtherBase{} }
|
||||
func (m *OtherBase) String() string { return proto.CompactTextString(m) }
|
||||
func (*OtherBase) ProtoMessage() {}
|
||||
|
||||
var extRange_OtherBase = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_OtherBase
|
||||
}
|
||||
|
||||
func (m *OtherBase) GetName() string {
|
||||
if m != nil && m.Name != nil {
|
||||
return *m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReplyExtensions struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
|
||||
func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplyExtensions) ProtoMessage() {}
|
||||
|
||||
var E_ReplyExtensions_Time = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*float64)(nil),
|
||||
Field: 101,
|
||||
Name: "my.test.ReplyExtensions.time",
|
||||
Tag: "fixed64,101,opt,name=time",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*ReplyExtensions)(nil),
|
||||
Field: 105,
|
||||
Name: "my.test.ReplyExtensions.carrot",
|
||||
Tag: "bytes,105,opt,name=carrot",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
|
||||
ExtendedType: (*OtherBase)(nil),
|
||||
ExtensionType: (*ReplyExtensions)(nil),
|
||||
Field: 101,
|
||||
Name: "my.test.ReplyExtensions.donut",
|
||||
Tag: "bytes,101,opt,name=donut",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
type OtherReplyExtensions struct {
|
||||
Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} }
|
||||
func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
|
||||
func (*OtherReplyExtensions) ProtoMessage() {}
|
||||
|
||||
func (m *OtherReplyExtensions) GetKey() int32 {
|
||||
if m != nil && m.Key != nil {
|
||||
return *m.Key
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type OldReply struct {
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OldReply) Reset() { *m = OldReply{} }
|
||||
func (m *OldReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*OldReply) ProtoMessage() {}
|
||||
|
||||
func (m *OldReply) Marshal() ([]byte, error) {
|
||||
return proto.MarshalMessageSet(&m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) Unmarshal(buf []byte) error {
|
||||
return proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) MarshalJSON() ([]byte, error) {
|
||||
return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) UnmarshalJSON(buf []byte) error {
|
||||
return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)
|
||||
}
|
||||
|
||||
// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler
|
||||
var _ proto.Marshaler = (*OldReply)(nil)
|
||||
var _ proto.Unmarshaler = (*OldReply)(nil)
|
||||
|
||||
var extRange_OldReply = []proto.ExtensionRange{
|
||||
{100, 2147483646},
|
||||
}
|
||||
|
||||
func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_OldReply
|
||||
}
|
||||
|
||||
type Communique struct {
|
||||
MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"`
|
||||
// This is a oneof, called "union".
|
||||
//
|
||||
// Types that are valid to be assigned to Union:
|
||||
// *Communique_Number
|
||||
// *Communique_Name
|
||||
// *Communique_Data
|
||||
// *Communique_TempC
|
||||
// *Communique_Height
|
||||
// *Communique_Today
|
||||
// *Communique_Maybe
|
||||
// *Communique_Delta_
|
||||
// *Communique_Msg
|
||||
// *Communique_Somegroup
|
||||
Union isCommunique_Union `protobuf_oneof:"union"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique) Reset() { *m = Communique{} }
|
||||
func (m *Communique) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique) ProtoMessage() {}
|
||||
|
||||
type isCommunique_Union interface {
|
||||
isCommunique_Union()
|
||||
}
|
||||
|
||||
type Communique_Number struct {
|
||||
Number int32 `protobuf:"varint,5,opt,name=number,oneof"`
|
||||
}
|
||||
type Communique_Name struct {
|
||||
Name string `protobuf:"bytes,6,opt,name=name,oneof"`
|
||||
}
|
||||
type Communique_Data struct {
|
||||
Data []byte `protobuf:"bytes,7,opt,name=data,oneof"`
|
||||
}
|
||||
type Communique_TempC struct {
|
||||
TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"`
|
||||
}
|
||||
type Communique_Height struct {
|
||||
Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"`
|
||||
}
|
||||
type Communique_Today struct {
|
||||
Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"`
|
||||
}
|
||||
type Communique_Maybe struct {
|
||||
Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"`
|
||||
}
|
||||
type Communique_Delta_ struct {
|
||||
Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"`
|
||||
}
|
||||
type Communique_Msg struct {
|
||||
Msg *Reply `protobuf:"bytes,13,opt,name=msg,oneof"`
|
||||
}
|
||||
type Communique_Somegroup struct {
|
||||
Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"`
|
||||
}
|
||||
|
||||
func (*Communique_Number) isCommunique_Union() {}
|
||||
func (*Communique_Name) isCommunique_Union() {}
|
||||
func (*Communique_Data) isCommunique_Union() {}
|
||||
func (*Communique_TempC) isCommunique_Union() {}
|
||||
func (*Communique_Height) isCommunique_Union() {}
|
||||
func (*Communique_Today) isCommunique_Union() {}
|
||||
func (*Communique_Maybe) isCommunique_Union() {}
|
||||
func (*Communique_Delta_) isCommunique_Union() {}
|
||||
func (*Communique_Msg) isCommunique_Union() {}
|
||||
func (*Communique_Somegroup) isCommunique_Union() {}
|
||||
|
||||
func (m *Communique) GetUnion() isCommunique_Union {
|
||||
if m != nil {
|
||||
return m.Union
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetMakeMeCry() bool {
|
||||
if m != nil && m.MakeMeCry != nil {
|
||||
return *m.MakeMeCry
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Communique) GetNumber() int32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Number); ok {
|
||||
return x.Number
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetName() string {
|
||||
if x, ok := m.GetUnion().(*Communique_Name); ok {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Communique) GetData() []byte {
|
||||
if x, ok := m.GetUnion().(*Communique_Data); ok {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetTempC() float64 {
|
||||
if x, ok := m.GetUnion().(*Communique_TempC); ok {
|
||||
return x.TempC
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetHeight() float32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Height); ok {
|
||||
return x.Height
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetToday() Days {
|
||||
if x, ok := m.GetUnion().(*Communique_Today); ok {
|
||||
return x.Today
|
||||
}
|
||||
return Days_MONDAY
|
||||
}
|
||||
|
||||
func (m *Communique) GetMaybe() bool {
|
||||
if x, ok := m.GetUnion().(*Communique_Maybe); ok {
|
||||
return x.Maybe
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Communique) GetDelta() int32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Delta_); ok {
|
||||
return x.Delta
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetMsg() *Reply {
|
||||
if x, ok := m.GetUnion().(*Communique_Msg); ok {
|
||||
return x.Msg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetSomegroup() *Communique_SomeGroup {
|
||||
if x, ok := m.GetUnion().(*Communique_Somegroup); ok {
|
||||
return x.Somegroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{
|
||||
(*Communique_Number)(nil),
|
||||
(*Communique_Name)(nil),
|
||||
(*Communique_Data)(nil),
|
||||
(*Communique_TempC)(nil),
|
||||
(*Communique_Height)(nil),
|
||||
(*Communique_Today)(nil),
|
||||
(*Communique_Maybe)(nil),
|
||||
(*Communique_Delta_)(nil),
|
||||
(*Communique_Msg)(nil),
|
||||
(*Communique_Somegroup)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*Communique)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *Communique_Number:
|
||||
b.EncodeVarint(5<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Number))
|
||||
case *Communique_Name:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Name)
|
||||
case *Communique_Data:
|
||||
b.EncodeVarint(7<<3 | proto.WireBytes)
|
||||
b.EncodeRawBytes(x.Data)
|
||||
case *Communique_TempC:
|
||||
b.EncodeVarint(8<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.TempC))
|
||||
case *Communique_Height:
|
||||
b.EncodeVarint(9<<3 | proto.WireFixed32)
|
||||
b.EncodeFixed32(uint64(math.Float32bits(x.Height)))
|
||||
case *Communique_Today:
|
||||
b.EncodeVarint(10<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Today))
|
||||
case *Communique_Maybe:
|
||||
t := uint64(0)
|
||||
if x.Maybe {
|
||||
t = 1
|
||||
}
|
||||
b.EncodeVarint(11<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(t)
|
||||
case *Communique_Delta_:
|
||||
b.EncodeVarint(12<<3 | proto.WireVarint)
|
||||
b.EncodeZigzag32(uint64(x.Delta))
|
||||
case *Communique_Msg:
|
||||
b.EncodeVarint(13<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Msg); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Communique_Somegroup:
|
||||
b.EncodeVarint(14<<3 | proto.WireStartGroup)
|
||||
if err := b.Marshal(x.Somegroup); err != nil {
|
||||
return err
|
||||
}
|
||||
b.EncodeVarint(14<<3 | proto.WireEndGroup)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("Communique.Union has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*Communique)
|
||||
switch tag {
|
||||
case 5: // union.number
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Number{int32(x)}
|
||||
return true, err
|
||||
case 6: // union.name
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Union = &Communique_Name{x}
|
||||
return true, err
|
||||
case 7: // union.data
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeRawBytes(true)
|
||||
m.Union = &Communique_Data{x}
|
||||
return true, err
|
||||
case 8: // union.temp_c
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Union = &Communique_TempC{math.Float64frombits(x)}
|
||||
return true, err
|
||||
case 9: // union.height
|
||||
if wire != proto.WireFixed32 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed32()
|
||||
m.Union = &Communique_Height{math.Float32frombits(uint32(x))}
|
||||
return true, err
|
||||
case 10: // union.today
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Today{Days(x)}
|
||||
return true, err
|
||||
case 11: // union.maybe
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Maybe{x != 0}
|
||||
return true, err
|
||||
case 12: // union.delta
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeZigzag32()
|
||||
m.Union = &Communique_Delta_{int32(x)}
|
||||
return true, err
|
||||
case 13: // union.msg
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Reply)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Union = &Communique_Msg{msg}
|
||||
return true, err
|
||||
case 14: // union.somegroup
|
||||
if wire != proto.WireStartGroup {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Communique_SomeGroup)
|
||||
err := b.DecodeGroup(msg)
|
||||
m.Union = &Communique_Somegroup{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _Communique_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*Communique)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *Communique_Number:
|
||||
n += proto.SizeVarint(5<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.Number))
|
||||
case *Communique_Name:
|
||||
n += proto.SizeVarint(6<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Name)))
|
||||
n += len(x.Name)
|
||||
case *Communique_Data:
|
||||
n += proto.SizeVarint(7<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Data)))
|
||||
n += len(x.Data)
|
||||
case *Communique_TempC:
|
||||
n += proto.SizeVarint(8<<3 | proto.WireFixed64)
|
||||
n += 8
|
||||
case *Communique_Height:
|
||||
n += proto.SizeVarint(9<<3 | proto.WireFixed32)
|
||||
n += 4
|
||||
case *Communique_Today:
|
||||
n += proto.SizeVarint(10<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.Today))
|
||||
case *Communique_Maybe:
|
||||
n += proto.SizeVarint(11<<3 | proto.WireVarint)
|
||||
n += 1
|
||||
case *Communique_Delta_:
|
||||
n += proto.SizeVarint(12<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31))))
|
||||
case *Communique_Msg:
|
||||
s := proto.Size(x.Msg)
|
||||
n += proto.SizeVarint(13<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Communique_Somegroup:
|
||||
n += proto.SizeVarint(14<<3 | proto.WireStartGroup)
|
||||
n += proto.Size(x.Somegroup)
|
||||
n += proto.SizeVarint(14<<3 | proto.WireEndGroup)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type Communique_SomeGroup struct {
|
||||
Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} }
|
||||
func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique_SomeGroup) ProtoMessage() {}
|
||||
|
||||
func (m *Communique_SomeGroup) GetMember() string {
|
||||
if m != nil && m.Member != nil {
|
||||
return *m.Member
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Communique_Delta struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique_Delta) Reset() { *m = Communique_Delta{} }
|
||||
func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique_Delta) ProtoMessage() {}
|
||||
|
||||
var E_Tag = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 103,
|
||||
Name: "my.test.tag",
|
||||
Tag: "bytes,103,opt,name=tag",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_Donut = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*OtherReplyExtensions)(nil),
|
||||
Field: 106,
|
||||
Name: "my.test.donut",
|
||||
Tag: "bytes,106,opt,name=donut",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Request)(nil), "my.test.Request")
|
||||
proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup")
|
||||
proto.RegisterType((*Reply)(nil), "my.test.Reply")
|
||||
proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry")
|
||||
proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase")
|
||||
proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions")
|
||||
proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions")
|
||||
proto.RegisterType((*OldReply)(nil), "my.test.OldReply")
|
||||
proto.RegisterType((*Communique)(nil), "my.test.Communique")
|
||||
proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup")
|
||||
proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta")
|
||||
proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value)
|
||||
proto.RegisterEnum("my.test.Days", Days_name, Days_value)
|
||||
proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value)
|
||||
proto.RegisterEnum("my.test.Reply_Entry_Game", Reply_Entry_Game_name, Reply_Entry_Game_value)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Time)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Carrot)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Donut)
|
||||
proto.RegisterExtension(E_Tag)
|
||||
proto.RegisterExtension(E_Donut)
|
||||
}
|
870
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden
generated
vendored
Normal file
870
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden
generated
vendored
Normal file
|
@ -0,0 +1,870 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: my_test/test.proto
|
||||
|
||||
/*
|
||||
Package my_test is a generated protocol buffer package.
|
||||
|
||||
This package holds interesting messages.
|
||||
|
||||
It is generated from these files:
|
||||
my_test/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Request
|
||||
Reply
|
||||
OtherBase
|
||||
ReplyExtensions
|
||||
OtherReplyExtensions
|
||||
OldReply
|
||||
Communique
|
||||
*/
|
||||
package my_test
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/golang/protobuf/protoc-gen-go/testdata/multi"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type HatType int32
|
||||
|
||||
const (
|
||||
// deliberately skipping 0
|
||||
HatType_FEDORA HatType = 1
|
||||
HatType_FEZ HatType = 2
|
||||
)
|
||||
|
||||
var HatType_name = map[int32]string{
|
||||
1: "FEDORA",
|
||||
2: "FEZ",
|
||||
}
|
||||
var HatType_value = map[string]int32{
|
||||
"FEDORA": 1,
|
||||
"FEZ": 2,
|
||||
}
|
||||
|
||||
func (x HatType) Enum() *HatType {
|
||||
p := new(HatType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x HatType) String() string {
|
||||
return proto.EnumName(HatType_name, int32(x))
|
||||
}
|
||||
func (x *HatType) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(HatType_value, data, "HatType")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = HatType(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
// This enum represents days of the week.
|
||||
type Days int32
|
||||
|
||||
const (
|
||||
Days_MONDAY Days = 1
|
||||
Days_TUESDAY Days = 2
|
||||
Days_LUNDI Days = 1
|
||||
)
|
||||
|
||||
var Days_name = map[int32]string{
|
||||
1: "MONDAY",
|
||||
2: "TUESDAY",
|
||||
// Duplicate value: 1: "LUNDI",
|
||||
}
|
||||
var Days_value = map[string]int32{
|
||||
"MONDAY": 1,
|
||||
"TUESDAY": 2,
|
||||
"LUNDI": 1,
|
||||
}
|
||||
|
||||
func (x Days) Enum() *Days {
|
||||
p := new(Days)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Days) String() string {
|
||||
return proto.EnumName(Days_name, int32(x))
|
||||
}
|
||||
func (x *Days) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Days_value, data, "Days")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Days(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Request_Color int32
|
||||
|
||||
const (
|
||||
Request_RED Request_Color = 0
|
||||
Request_GREEN Request_Color = 1
|
||||
Request_BLUE Request_Color = 2
|
||||
)
|
||||
|
||||
var Request_Color_name = map[int32]string{
|
||||
0: "RED",
|
||||
1: "GREEN",
|
||||
2: "BLUE",
|
||||
}
|
||||
var Request_Color_value = map[string]int32{
|
||||
"RED": 0,
|
||||
"GREEN": 1,
|
||||
"BLUE": 2,
|
||||
}
|
||||
|
||||
func (x Request_Color) Enum() *Request_Color {
|
||||
p := new(Request_Color)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Request_Color) String() string {
|
||||
return proto.EnumName(Request_Color_name, int32(x))
|
||||
}
|
||||
func (x *Request_Color) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Request_Color_value, data, "Request_Color")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Request_Color(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Reply_Entry_Game int32
|
||||
|
||||
const (
|
||||
Reply_Entry_FOOTBALL Reply_Entry_Game = 1
|
||||
Reply_Entry_TENNIS Reply_Entry_Game = 2
|
||||
)
|
||||
|
||||
var Reply_Entry_Game_name = map[int32]string{
|
||||
1: "FOOTBALL",
|
||||
2: "TENNIS",
|
||||
}
|
||||
var Reply_Entry_Game_value = map[string]int32{
|
||||
"FOOTBALL": 1,
|
||||
"TENNIS": 2,
|
||||
}
|
||||
|
||||
func (x Reply_Entry_Game) Enum() *Reply_Entry_Game {
|
||||
p := new(Reply_Entry_Game)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Reply_Entry_Game) String() string {
|
||||
return proto.EnumName(Reply_Entry_Game_name, int32(x))
|
||||
}
|
||||
func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, "Reply_Entry_Game")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Reply_Entry_Game(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
// This is a message that might be sent somewhere.
|
||||
type Request struct {
|
||||
Key []int64 `protobuf:"varint,1,rep,name=key" json:"key,omitempty"`
|
||||
// optional imp.ImportedMessage imported_message = 2;
|
||||
Hue *Request_Color `protobuf:"varint,3,opt,name=hue,enum=my.test.Request_Color" json:"hue,omitempty"`
|
||||
Hat *HatType `protobuf:"varint,4,opt,name=hat,enum=my.test.HatType,def=1" json:"hat,omitempty"`
|
||||
// optional imp.ImportedMessage.Owner owner = 6;
|
||||
Deadline *float32 `protobuf:"fixed32,7,opt,name=deadline,def=inf" json:"deadline,omitempty"`
|
||||
Somegroup *Request_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"`
|
||||
// This is a map field. It will generate map[int32]string.
|
||||
NameMapping map[int32]string `protobuf:"bytes,14,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// This is a map field whose value type is a message.
|
||||
MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"`
|
||||
// This field should not conflict with any getters.
|
||||
GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request) Reset() { *m = Request{} }
|
||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
|
||||
const Default_Request_Hat HatType = HatType_FEDORA
|
||||
|
||||
var Default_Request_Deadline float32 = float32(math.Inf(1))
|
||||
|
||||
func (m *Request) GetKey() []int64 {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetHue() Request_Color {
|
||||
if m != nil && m.Hue != nil {
|
||||
return *m.Hue
|
||||
}
|
||||
return Request_RED
|
||||
}
|
||||
|
||||
func (m *Request) GetHat() HatType {
|
||||
if m != nil && m.Hat != nil {
|
||||
return *m.Hat
|
||||
}
|
||||
return Default_Request_Hat
|
||||
}
|
||||
|
||||
func (m *Request) GetDeadline() float32 {
|
||||
if m != nil && m.Deadline != nil {
|
||||
return *m.Deadline
|
||||
}
|
||||
return Default_Request_Deadline
|
||||
}
|
||||
|
||||
func (m *Request) GetSomegroup() *Request_SomeGroup {
|
||||
if m != nil {
|
||||
return m.Somegroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetNameMapping() map[int32]string {
|
||||
if m != nil {
|
||||
return m.NameMapping
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetMsgMapping() map[int64]*Reply {
|
||||
if m != nil {
|
||||
return m.MsgMapping
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetReset_() int32 {
|
||||
if m != nil && m.Reset_ != nil {
|
||||
return *m.Reset_
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetGetKey_() string {
|
||||
if m != nil && m.GetKey_ != nil {
|
||||
return *m.GetKey_
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Request_SomeGroup struct {
|
||||
GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} }
|
||||
func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request_SomeGroup) ProtoMessage() {}
|
||||
|
||||
func (m *Request_SomeGroup) GetGroupField() int32 {
|
||||
if m != nil && m.GroupField != nil {
|
||||
return *m.GroupField
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Reply struct {
|
||||
Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"`
|
||||
CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Reply) Reset() { *m = Reply{} }
|
||||
func (m *Reply) String() string { return proto.CompactTextString(m) }
|
||||
func (*Reply) ProtoMessage() {}
|
||||
|
||||
var extRange_Reply = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*Reply) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Reply
|
||||
}
|
||||
|
||||
func (m *Reply) GetFound() []*Reply_Entry {
|
||||
if m != nil {
|
||||
return m.Found
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Reply) GetCompactKeys() []int32 {
|
||||
if m != nil {
|
||||
return m.CompactKeys
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Reply_Entry struct {
|
||||
KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"`
|
||||
Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"`
|
||||
XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
|
||||
func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
|
||||
func (*Reply_Entry) ProtoMessage() {}
|
||||
|
||||
const Default_Reply_Entry_Value int64 = 7
|
||||
|
||||
func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
|
||||
if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {
|
||||
return *m.KeyThatNeeds_1234Camel_CasIng
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) GetValue() int64 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return Default_Reply_Entry_Value
|
||||
}
|
||||
|
||||
func (m *Reply_Entry) GetXMyFieldName_2() int64 {
|
||||
if m != nil && m.XMyFieldName_2 != nil {
|
||||
return *m.XMyFieldName_2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type OtherBase struct {
|
||||
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OtherBase) Reset() { *m = OtherBase{} }
|
||||
func (m *OtherBase) String() string { return proto.CompactTextString(m) }
|
||||
func (*OtherBase) ProtoMessage() {}
|
||||
|
||||
var extRange_OtherBase = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_OtherBase
|
||||
}
|
||||
|
||||
func (m *OtherBase) GetName() string {
|
||||
if m != nil && m.Name != nil {
|
||||
return *m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReplyExtensions struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
|
||||
func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplyExtensions) ProtoMessage() {}
|
||||
|
||||
var E_ReplyExtensions_Time = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*float64)(nil),
|
||||
Field: 101,
|
||||
Name: "my.test.ReplyExtensions.time",
|
||||
Tag: "fixed64,101,opt,name=time",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*ReplyExtensions)(nil),
|
||||
Field: 105,
|
||||
Name: "my.test.ReplyExtensions.carrot",
|
||||
Tag: "bytes,105,opt,name=carrot",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_ReplyExtensions_Donut = &proto.ExtensionDesc{
|
||||
ExtendedType: (*OtherBase)(nil),
|
||||
ExtensionType: (*ReplyExtensions)(nil),
|
||||
Field: 101,
|
||||
Name: "my.test.ReplyExtensions.donut",
|
||||
Tag: "bytes,101,opt,name=donut",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
type OtherReplyExtensions struct {
|
||||
Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} }
|
||||
func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
|
||||
func (*OtherReplyExtensions) ProtoMessage() {}
|
||||
|
||||
func (m *OtherReplyExtensions) GetKey() int32 {
|
||||
if m != nil && m.Key != nil {
|
||||
return *m.Key
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type OldReply struct {
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OldReply) Reset() { *m = OldReply{} }
|
||||
func (m *OldReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*OldReply) ProtoMessage() {}
|
||||
|
||||
func (m *OldReply) Marshal() ([]byte, error) {
|
||||
return proto.MarshalMessageSet(&m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) Unmarshal(buf []byte) error {
|
||||
return proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) MarshalJSON() ([]byte, error) {
|
||||
return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
|
||||
}
|
||||
func (m *OldReply) UnmarshalJSON(buf []byte) error {
|
||||
return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)
|
||||
}
|
||||
|
||||
// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler
|
||||
var _ proto.Marshaler = (*OldReply)(nil)
|
||||
var _ proto.Unmarshaler = (*OldReply)(nil)
|
||||
|
||||
var extRange_OldReply = []proto.ExtensionRange{
|
||||
{100, 2147483646},
|
||||
}
|
||||
|
||||
func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_OldReply
|
||||
}
|
||||
|
||||
type Communique struct {
|
||||
MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"`
|
||||
// This is a oneof, called "union".
|
||||
//
|
||||
// Types that are valid to be assigned to Union:
|
||||
// *Communique_Number
|
||||
// *Communique_Name
|
||||
// *Communique_Data
|
||||
// *Communique_TempC
|
||||
// *Communique_Height
|
||||
// *Communique_Today
|
||||
// *Communique_Maybe
|
||||
// *Communique_Delta_
|
||||
// *Communique_Msg
|
||||
// *Communique_Somegroup
|
||||
Union isCommunique_Union `protobuf_oneof:"union"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique) Reset() { *m = Communique{} }
|
||||
func (m *Communique) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique) ProtoMessage() {}
|
||||
|
||||
type isCommunique_Union interface {
|
||||
isCommunique_Union()
|
||||
}
|
||||
|
||||
type Communique_Number struct {
|
||||
Number int32 `protobuf:"varint,5,opt,name=number,oneof"`
|
||||
}
|
||||
type Communique_Name struct {
|
||||
Name string `protobuf:"bytes,6,opt,name=name,oneof"`
|
||||
}
|
||||
type Communique_Data struct {
|
||||
Data []byte `protobuf:"bytes,7,opt,name=data,oneof"`
|
||||
}
|
||||
type Communique_TempC struct {
|
||||
TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"`
|
||||
}
|
||||
type Communique_Height struct {
|
||||
Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"`
|
||||
}
|
||||
type Communique_Today struct {
|
||||
Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"`
|
||||
}
|
||||
type Communique_Maybe struct {
|
||||
Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"`
|
||||
}
|
||||
type Communique_Delta_ struct {
|
||||
Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"`
|
||||
}
|
||||
type Communique_Msg struct {
|
||||
Msg *Reply `protobuf:"bytes,13,opt,name=msg,oneof"`
|
||||
}
|
||||
type Communique_Somegroup struct {
|
||||
Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"`
|
||||
}
|
||||
|
||||
func (*Communique_Number) isCommunique_Union() {}
|
||||
func (*Communique_Name) isCommunique_Union() {}
|
||||
func (*Communique_Data) isCommunique_Union() {}
|
||||
func (*Communique_TempC) isCommunique_Union() {}
|
||||
func (*Communique_Height) isCommunique_Union() {}
|
||||
func (*Communique_Today) isCommunique_Union() {}
|
||||
func (*Communique_Maybe) isCommunique_Union() {}
|
||||
func (*Communique_Delta_) isCommunique_Union() {}
|
||||
func (*Communique_Msg) isCommunique_Union() {}
|
||||
func (*Communique_Somegroup) isCommunique_Union() {}
|
||||
|
||||
func (m *Communique) GetUnion() isCommunique_Union {
|
||||
if m != nil {
|
||||
return m.Union
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetMakeMeCry() bool {
|
||||
if m != nil && m.MakeMeCry != nil {
|
||||
return *m.MakeMeCry
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Communique) GetNumber() int32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Number); ok {
|
||||
return x.Number
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetName() string {
|
||||
if x, ok := m.GetUnion().(*Communique_Name); ok {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Communique) GetData() []byte {
|
||||
if x, ok := m.GetUnion().(*Communique_Data); ok {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetTempC() float64 {
|
||||
if x, ok := m.GetUnion().(*Communique_TempC); ok {
|
||||
return x.TempC
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetHeight() float32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Height); ok {
|
||||
return x.Height
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetToday() Days {
|
||||
if x, ok := m.GetUnion().(*Communique_Today); ok {
|
||||
return x.Today
|
||||
}
|
||||
return Days_MONDAY
|
||||
}
|
||||
|
||||
func (m *Communique) GetMaybe() bool {
|
||||
if x, ok := m.GetUnion().(*Communique_Maybe); ok {
|
||||
return x.Maybe
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Communique) GetDelta() int32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Delta_); ok {
|
||||
return x.Delta
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Communique) GetMsg() *Reply {
|
||||
if x, ok := m.GetUnion().(*Communique_Msg); ok {
|
||||
return x.Msg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetSomegroup() *Communique_SomeGroup {
|
||||
if x, ok := m.GetUnion().(*Communique_Somegroup); ok {
|
||||
return x.Somegroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{
|
||||
(*Communique_Number)(nil),
|
||||
(*Communique_Name)(nil),
|
||||
(*Communique_Data)(nil),
|
||||
(*Communique_TempC)(nil),
|
||||
(*Communique_Height)(nil),
|
||||
(*Communique_Today)(nil),
|
||||
(*Communique_Maybe)(nil),
|
||||
(*Communique_Delta_)(nil),
|
||||
(*Communique_Msg)(nil),
|
||||
(*Communique_Somegroup)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*Communique)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *Communique_Number:
|
||||
b.EncodeVarint(5<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Number))
|
||||
case *Communique_Name:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Name)
|
||||
case *Communique_Data:
|
||||
b.EncodeVarint(7<<3 | proto.WireBytes)
|
||||
b.EncodeRawBytes(x.Data)
|
||||
case *Communique_TempC:
|
||||
b.EncodeVarint(8<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.TempC))
|
||||
case *Communique_Height:
|
||||
b.EncodeVarint(9<<3 | proto.WireFixed32)
|
||||
b.EncodeFixed32(uint64(math.Float32bits(x.Height)))
|
||||
case *Communique_Today:
|
||||
b.EncodeVarint(10<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Today))
|
||||
case *Communique_Maybe:
|
||||
t := uint64(0)
|
||||
if x.Maybe {
|
||||
t = 1
|
||||
}
|
||||
b.EncodeVarint(11<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(t)
|
||||
case *Communique_Delta_:
|
||||
b.EncodeVarint(12<<3 | proto.WireVarint)
|
||||
b.EncodeZigzag32(uint64(x.Delta))
|
||||
case *Communique_Msg:
|
||||
b.EncodeVarint(13<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Msg); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Communique_Somegroup:
|
||||
b.EncodeVarint(14<<3 | proto.WireStartGroup)
|
||||
if err := b.Marshal(x.Somegroup); err != nil {
|
||||
return err
|
||||
}
|
||||
b.EncodeVarint(14<<3 | proto.WireEndGroup)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("Communique.Union has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*Communique)
|
||||
switch tag {
|
||||
case 5: // union.number
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Number{int32(x)}
|
||||
return true, err
|
||||
case 6: // union.name
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Union = &Communique_Name{x}
|
||||
return true, err
|
||||
case 7: // union.data
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeRawBytes(true)
|
||||
m.Union = &Communique_Data{x}
|
||||
return true, err
|
||||
case 8: // union.temp_c
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Union = &Communique_TempC{math.Float64frombits(x)}
|
||||
return true, err
|
||||
case 9: // union.height
|
||||
if wire != proto.WireFixed32 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed32()
|
||||
m.Union = &Communique_Height{math.Float32frombits(uint32(x))}
|
||||
return true, err
|
||||
case 10: // union.today
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Today{Days(x)}
|
||||
return true, err
|
||||
case 11: // union.maybe
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &Communique_Maybe{x != 0}
|
||||
return true, err
|
||||
case 12: // union.delta
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeZigzag32()
|
||||
m.Union = &Communique_Delta_{int32(x)}
|
||||
return true, err
|
||||
case 13: // union.msg
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Reply)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Union = &Communique_Msg{msg}
|
||||
return true, err
|
||||
case 14: // union.somegroup
|
||||
if wire != proto.WireStartGroup {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Communique_SomeGroup)
|
||||
err := b.DecodeGroup(msg)
|
||||
m.Union = &Communique_Somegroup{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _Communique_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*Communique)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *Communique_Number:
|
||||
n += proto.SizeVarint(5<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.Number))
|
||||
case *Communique_Name:
|
||||
n += proto.SizeVarint(6<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Name)))
|
||||
n += len(x.Name)
|
||||
case *Communique_Data:
|
||||
n += proto.SizeVarint(7<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Data)))
|
||||
n += len(x.Data)
|
||||
case *Communique_TempC:
|
||||
n += proto.SizeVarint(8<<3 | proto.WireFixed64)
|
||||
n += 8
|
||||
case *Communique_Height:
|
||||
n += proto.SizeVarint(9<<3 | proto.WireFixed32)
|
||||
n += 4
|
||||
case *Communique_Today:
|
||||
n += proto.SizeVarint(10<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.Today))
|
||||
case *Communique_Maybe:
|
||||
n += proto.SizeVarint(11<<3 | proto.WireVarint)
|
||||
n += 1
|
||||
case *Communique_Delta_:
|
||||
n += proto.SizeVarint(12<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31))))
|
||||
case *Communique_Msg:
|
||||
s := proto.Size(x.Msg)
|
||||
n += proto.SizeVarint(13<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Communique_Somegroup:
|
||||
n += proto.SizeVarint(14<<3 | proto.WireStartGroup)
|
||||
n += proto.Size(x.Somegroup)
|
||||
n += proto.SizeVarint(14<<3 | proto.WireEndGroup)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type Communique_SomeGroup struct {
|
||||
Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} }
|
||||
func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique_SomeGroup) ProtoMessage() {}
|
||||
|
||||
func (m *Communique_SomeGroup) GetMember() string {
|
||||
if m != nil && m.Member != nil {
|
||||
return *m.Member
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Communique_Delta struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Communique_Delta) Reset() { *m = Communique_Delta{} }
|
||||
func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
|
||||
func (*Communique_Delta) ProtoMessage() {}
|
||||
|
||||
var E_Tag = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 103,
|
||||
Name: "my.test.tag",
|
||||
Tag: "bytes,103,opt,name=tag",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
var E_Donut = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Reply)(nil),
|
||||
ExtensionType: (*OtherReplyExtensions)(nil),
|
||||
Field: 106,
|
||||
Name: "my.test.donut",
|
||||
Tag: "bytes,106,opt,name=donut",
|
||||
Filename: "my_test/test.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Request)(nil), "my.test.Request")
|
||||
proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup")
|
||||
proto.RegisterType((*Reply)(nil), "my.test.Reply")
|
||||
proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry")
|
||||
proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase")
|
||||
proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions")
|
||||
proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions")
|
||||
proto.RegisterType((*OldReply)(nil), "my.test.OldReply")
|
||||
proto.RegisterType((*Communique)(nil), "my.test.Communique")
|
||||
proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup")
|
||||
proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta")
|
||||
proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value)
|
||||
proto.RegisterEnum("my.test.Days", Days_name, Days_value)
|
||||
proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value)
|
||||
proto.RegisterEnum("my.test.Reply_Entry_Game", Reply_Entry_Game_name, Reply_Entry_Game_value)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Time)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Carrot)
|
||||
proto.RegisterExtension(E_ReplyExtensions_Donut)
|
||||
proto.RegisterExtension(E_Tag)
|
||||
proto.RegisterExtension(E_Donut)
|
||||
}
|
156
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto
generated
vendored
Normal file
156
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
// This package holds interesting messages.
|
||||
package my.test; // dotted package name
|
||||
|
||||
//import "imp.proto";
|
||||
import "multi/multi1.proto"; // unused import
|
||||
|
||||
enum HatType {
|
||||
// deliberately skipping 0
|
||||
FEDORA = 1;
|
||||
FEZ = 2;
|
||||
}
|
||||
|
||||
// This enum represents days of the week.
|
||||
enum Days {
|
||||
option allow_alias = true;
|
||||
|
||||
MONDAY = 1;
|
||||
TUESDAY = 2;
|
||||
LUNDI = 1; // same value as MONDAY
|
||||
}
|
||||
|
||||
// This is a message that might be sent somewhere.
|
||||
message Request {
|
||||
enum Color {
|
||||
RED = 0;
|
||||
GREEN = 1;
|
||||
BLUE = 2;
|
||||
}
|
||||
repeated int64 key = 1;
|
||||
// optional imp.ImportedMessage imported_message = 2;
|
||||
optional Color hue = 3; // no default
|
||||
optional HatType hat = 4 [default=FEDORA];
|
||||
// optional imp.ImportedMessage.Owner owner = 6;
|
||||
optional float deadline = 7 [default=inf];
|
||||
optional group SomeGroup = 8 {
|
||||
optional int32 group_field = 9;
|
||||
}
|
||||
|
||||
// These foreign types are in imp2.proto,
|
||||
// which is publicly imported by imp.proto.
|
||||
// optional imp.PubliclyImportedMessage pub = 10;
|
||||
// optional imp.PubliclyImportedEnum pub_enum = 13 [default=HAIR];
|
||||
|
||||
|
||||
// This is a map field. It will generate map[int32]string.
|
||||
map<int32, string> name_mapping = 14;
|
||||
// This is a map field whose value type is a message.
|
||||
map<sint64, Reply> msg_mapping = 15;
|
||||
|
||||
optional int32 reset = 12;
|
||||
// This field should not conflict with any getters.
|
||||
optional string get_key = 16;
|
||||
}
|
||||
|
||||
message Reply {
|
||||
message Entry {
|
||||
required int64 key_that_needs_1234camel_CasIng = 1;
|
||||
optional int64 value = 2 [default=7];
|
||||
optional int64 _my_field_name_2 = 3;
|
||||
enum Game {
|
||||
FOOTBALL = 1;
|
||||
TENNIS = 2;
|
||||
}
|
||||
}
|
||||
repeated Entry found = 1;
|
||||
repeated int32 compact_keys = 2 [packed=true];
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
message OtherBase {
|
||||
optional string name = 1;
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
message ReplyExtensions {
|
||||
extend Reply {
|
||||
optional double time = 101;
|
||||
optional ReplyExtensions carrot = 105;
|
||||
}
|
||||
extend OtherBase {
|
||||
optional ReplyExtensions donut = 101;
|
||||
}
|
||||
}
|
||||
|
||||
message OtherReplyExtensions {
|
||||
optional int32 key = 1;
|
||||
}
|
||||
|
||||
// top-level extension
|
||||
extend Reply {
|
||||
optional string tag = 103;
|
||||
optional OtherReplyExtensions donut = 106;
|
||||
// optional imp.ImportedMessage elephant = 107; // extend with message from another file.
|
||||
}
|
||||
|
||||
message OldReply {
|
||||
// Extensions will be encoded in MessageSet wire format.
|
||||
option message_set_wire_format = true;
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
message Communique {
|
||||
optional bool make_me_cry = 1;
|
||||
|
||||
// This is a oneof, called "union".
|
||||
oneof union {
|
||||
int32 number = 5;
|
||||
string name = 6;
|
||||
bytes data = 7;
|
||||
double temp_c = 8;
|
||||
float height = 9;
|
||||
Days today = 10;
|
||||
bool maybe = 11;
|
||||
sint32 delta = 12; // name will conflict with Delta below
|
||||
Reply msg = 13;
|
||||
group SomeGroup = 14 {
|
||||
optional string member = 15;
|
||||
}
|
||||
}
|
||||
|
||||
message Delta {}
|
||||
}
|
||||
|
53
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto
generated
vendored
Normal file
53
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package proto3;
|
||||
|
||||
message Request {
|
||||
enum Flavour {
|
||||
SWEET = 0;
|
||||
SOUR = 1;
|
||||
UMAMI = 2;
|
||||
GOPHERLICIOUS = 3;
|
||||
}
|
||||
string name = 1;
|
||||
repeated int64 key = 2;
|
||||
Flavour taste = 3;
|
||||
Book book = 4;
|
||||
repeated int64 unpacked = 5 [packed=false];
|
||||
}
|
||||
|
||||
message Book {
|
||||
string title = 1;
|
||||
bytes raw_data = 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue