[dev] protoc-gen-go: reorganize, fix testdata directory
"make test" now compiles all the source files in testdata/ using the
protoc-gen-go in the current working directory and compares the output
to golden versions, "make regenerate" rebuilds the golden files.
Add a go_package option to each proto source file. Put the sources for
each package in the proper directory.
Add a golden_test.go which arranges to compile each source file using
the compiler in the working tree.
This does not touch the content of any of the sources in testdata/
other than to add go_package options and fix up import paths.
Change-Id: Iea5bef9bba626116b8ce5ea136a15f3cff4f5bcc
diff --git a/protoc-gen-go/Makefile b/protoc-gen-go/Makefile
index a42cc37..2419c4d 100644
--- a/protoc-gen-go/Makefile
+++ b/protoc-gen-go/Makefile
@@ -30,4 +30,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
test:
+ go test
cd testdata && make test
+
+regenerate:
+ go test --regenerate
diff --git a/protoc-gen-go/golden_test.go b/protoc-gen-go/golden_test.go
new file mode 100644
index 0000000..4dca0fc
--- /dev/null
+++ b/protoc-gen-go/golden_test.go
@@ -0,0 +1,127 @@
+package main
+
+import (
+ "bytes"
+ "flag"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+// Set --regenerate to regenerate the golden files.
+var regenerate = flag.Bool("regenerate", false, "regenerate golden files")
+
+// When the environment variable RUN_AS_PROTOC_GEN_GO is set, we skip running
+// tests and instead act as protoc-gen-go. This allows the test binary to
+// pass itself to protoc.
+func init() {
+ if os.Getenv("RUN_AS_PROTOC_GEN_GO") != "" {
+ main()
+ os.Exit(0)
+ }
+}
+
+func TestGolden(t *testing.T) {
+ workdir, err := ioutil.TempDir("", "proto-test")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(workdir)
+
+ // Find all the proto files we need to compile. We assume that each directory
+ // contains the files for a single package.
+ packages := map[string][]string{}
+ err = filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error {
+ if !strings.HasSuffix(path, ".proto") {
+ return nil
+ }
+ dir := filepath.Dir(path)
+ packages[dir] = append(packages[dir], path)
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Compile each package, using this binary as protoc-gen-go.
+ //
+ // We set the RUN_AS_PROTOC_GEN_GO environment variable to indicate that
+ // the subprocess should act as a proto compiler rather than a test.
+ for _, sources := range packages {
+ cmd := exec.Command(
+ "protoc",
+ "--plugin=protoc-gen-go="+os.Args[0],
+ "-Itestdata",
+ "--go_out="+workdir,
+ )
+ cmd.Args = append(cmd.Args, sources...)
+ cmd.Env = append(os.Environ(), "RUN_AS_PROTOC_GEN_GO=1")
+ t.Log(strings.Join(cmd.Args, " "))
+ out, err := cmd.CombinedOutput()
+ if len(out) > 0 {
+ t.Log(string(out))
+ }
+ if err != nil {
+ t.Fatalf("failed to compile: %v", sources)
+ }
+ }
+
+ // Compare each generated file to the golden version.
+ relRoot := filepath.Join(workdir, "github.com/golang/protobuf/protoc-gen-go/testdata")
+ filepath.Walk(workdir, func(genPath string, info os.FileInfo, _ error) error {
+ if info.IsDir() {
+ return nil
+ }
+
+ // For each generated file, figure out the path to the corresponding
+ // golden file in the testdata directory.
+ relPath, err := filepath.Rel(relRoot, genPath)
+ if err != nil {
+ t.Errorf("filepath.Rel(%q, %q): %v", relRoot, genPath, err)
+ return nil
+ }
+ if filepath.SplitList(relPath)[0] == ".." {
+ t.Errorf("generated file %q is not relative to %q", genPath, relRoot)
+ }
+ goldenPath := filepath.Join("testdata", relPath)
+
+ got, err := ioutil.ReadFile(genPath)
+ if err != nil {
+ t.Error(err)
+ return nil
+ }
+ if *regenerate {
+ // If --regenerate set, just rewrite the golden files.
+ err := ioutil.WriteFile(goldenPath, got, 0666)
+ if err != nil {
+ t.Error(err)
+ }
+ return nil
+ }
+
+ want, err := ioutil.ReadFile(goldenPath)
+ if err != nil {
+ t.Error(err)
+ return nil
+ }
+
+ want = fdescRE.ReplaceAll(want, nil)
+ got = fdescRE.ReplaceAll(got, nil)
+ if bytes.Equal(got, want) {
+ return nil
+ }
+
+ //
+
+ cmd := exec.Command("diff", "-u", goldenPath, genPath)
+ out, _ := cmd.CombinedOutput()
+ t.Errorf("golden file differs: %v\n%v", relPath, string(out))
+ return nil
+ })
+}
+
+var fdescRE = regexp.MustCompile(`(?ms)^var fileDescriptor.*}`)
diff --git a/protoc-gen-go/testdata/Makefile b/protoc-gen-go/testdata/Makefile
index 945e7d0..b6525c2 100644
--- a/protoc-gen-go/testdata/Makefile
+++ b/protoc-gen-go/testdata/Makefile
@@ -29,56 +29,5 @@
# (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
-
- make -B deprecated/deprecated.pb.go
- sed -i -e '/return.*fileDescriptor/d' deprecated/deprecated.pb.go
- sed -i -e '/^var fileDescriptor/,/^}/d' deprecated/deprecated.pb.go
- sed -i -e '/proto.RegisterFile.*fileDescriptor/d' deprecated/deprecated.pb.go
- gofmt -w deprecated/deprecated.pb.go
- diff -w deprecated/deprecated.pb.go deprecated/deprecated.pb.go.golden
-
-
-deprecated/deprecated.pb.go: deprecated/deprecated.proto
- protoc --go_out=plugins=grpc,import_path=Mdeprecated/deprecated.proto=github.com/golang/protobuf/protoc-gen-go/testdata/deprecated:. $<
-
-nuke: clean
-
-testbuild: regenerate
+test:
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
diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go
index 1cdbe42..7511f66 100644
--- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go
+++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go
@@ -19,11 +19,6 @@
import fmt "fmt"
import math "math"
-import (
- context "golang.org/x/net/context"
- grpc "google.golang.org/grpc"
-)
-
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
@@ -52,6 +47,7 @@
func (x DeprecatedEnum) String() string {
return proto.EnumName(DeprecatedEnum_name, int32(x))
}
+func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
// DeprecatedRequest is a request to DeprecatedCall.
//
@@ -62,9 +58,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} }
-func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) }
-func (*DeprecatedRequest) ProtoMessage() {}
+func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} }
+func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) }
+func (*DeprecatedRequest) ProtoMessage() {}
+func (*DeprecatedRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *DeprecatedRequest) Unmarshal(b []byte) error {
return xxx_messageInfo_DeprecatedRequest.Unmarshal(m, b)
}
@@ -92,9 +89,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} }
-func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) }
-func (*DeprecatedResponse) ProtoMessage() {}
+func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} }
+func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) }
+func (*DeprecatedResponse) ProtoMessage() {}
+func (*DeprecatedResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *DeprecatedResponse) Unmarshal(b []byte) error {
return xxx_messageInfo_DeprecatedResponse.Unmarshal(m, b)
}
@@ -127,81 +125,24 @@
proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value)
}
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
+func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor0) }
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
-
-// Client API for DeprecatedService service
-
-// Deprecated: Do not use.
-type DeprecatedServiceClient interface {
- // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
- DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error)
-}
-
-type deprecatedServiceClient struct {
- cc *grpc.ClientConn
-}
-
-// Deprecated: Do not use.
-func NewDeprecatedServiceClient(cc *grpc.ClientConn) DeprecatedServiceClient {
- return &deprecatedServiceClient{cc}
-}
-
-// Deprecated: Do not use.
-func (c *deprecatedServiceClient) DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) {
- out := new(DeprecatedResponse)
- err := grpc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for DeprecatedService service
-
-// Deprecated: Do not use.
-type DeprecatedServiceServer interface {
- // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
- DeprecatedCall(context.Context, *DeprecatedRequest) (*DeprecatedResponse, error)
-}
-
-// Deprecated: Do not use.
-func RegisterDeprecatedServiceServer(s *grpc.Server, srv DeprecatedServiceServer) {
- s.RegisterService(&_DeprecatedService_serviceDesc, srv)
-}
-
-func _DeprecatedService_DeprecatedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeprecatedRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/deprecated.DeprecatedService/DeprecatedCall",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, req.(*DeprecatedRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _DeprecatedService_serviceDesc = grpc.ServiceDesc{
- ServiceName: "deprecated.DeprecatedService",
- HandlerType: (*DeprecatedServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "DeprecatedCall",
- Handler: _DeprecatedService_DeprecatedCall_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "deprecated/deprecated.proto",
+var fileDescriptor0 = []byte{
+ // 248 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28,
+ 0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85,
+ 0xb8, 0x10, 0x22, 0x4a, 0xe2, 0x5c, 0x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0x92, 0x92, 0x58, 0x92, 0x88,
+ 0x14, 0xd2, 0x3b, 0x18, 0x19, 0x93, 0xd8, 0xc0, 0xaa, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff,
+ 0x0e, 0xf5, 0x6c, 0x87, 0x8c, 0x01, 0x00, 0x00,
}
diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go.golden b/protoc-gen-go/testdata/deprecated/deprecated.pb.go.golden
deleted file mode 100644
index 1cdbe42..0000000
--- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go.golden
+++ /dev/null
@@ -1,207 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// deprecated/deprecated.proto is a deprecated file.
-
-/*
-Package deprecated is a generated protocol buffer package.
-
-package deprecated contains only deprecated messages and services.
-
-It is generated from these files:
- deprecated/deprecated.proto
-
-It has these top-level messages:
- DeprecatedRequest
- DeprecatedResponse
-*/
-package deprecated
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-import (
- context "golang.org/x/net/context"
- grpc "google.golang.org/grpc"
-)
-
-// 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
-
-// DeprecatedEnum contains deprecated values.
-type DeprecatedEnum int32 // Deprecated: Do not use.
-const (
- // DEPRECATED is the iota value of this enum.
- DeprecatedEnum_DEPRECATED DeprecatedEnum = 0 // Deprecated: Do not use.
-)
-
-var DeprecatedEnum_name = map[int32]string{
- 0: "DEPRECATED",
-}
-var DeprecatedEnum_value = map[string]int32{
- "DEPRECATED": 0,
-}
-
-func (x DeprecatedEnum) String() string {
- return proto.EnumName(DeprecatedEnum_name, int32(x))
-}
-
-// DeprecatedRequest is a request to DeprecatedCall.
-//
-// Deprecated: Do not use.
-type DeprecatedRequest struct {
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *DeprecatedRequest) Reset() { *m = DeprecatedRequest{} }
-func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) }
-func (*DeprecatedRequest) ProtoMessage() {}
-func (m *DeprecatedRequest) Unmarshal(b []byte) error {
- return xxx_messageInfo_DeprecatedRequest.Unmarshal(m, b)
-}
-func (m *DeprecatedRequest) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_DeprecatedRequest.Marshal(b, m, deterministic)
-}
-func (dst *DeprecatedRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_DeprecatedRequest.Merge(dst, src)
-}
-func (m *DeprecatedRequest) XXX_Size() int {
- return xxx_messageInfo_DeprecatedRequest.Size(m)
-}
-func (m *DeprecatedRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_DeprecatedRequest.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_DeprecatedRequest proto.InternalMessageInfo
-
-// Deprecated: Do not use.
-type DeprecatedResponse struct {
- // DeprecatedField contains a DeprecatedEnum.
- DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use.
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *DeprecatedResponse) Reset() { *m = DeprecatedResponse{} }
-func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) }
-func (*DeprecatedResponse) ProtoMessage() {}
-func (m *DeprecatedResponse) Unmarshal(b []byte) error {
- return xxx_messageInfo_DeprecatedResponse.Unmarshal(m, b)
-}
-func (m *DeprecatedResponse) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_DeprecatedResponse.Marshal(b, m, deterministic)
-}
-func (dst *DeprecatedResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_DeprecatedResponse.Merge(dst, src)
-}
-func (m *DeprecatedResponse) XXX_Size() int {
- return xxx_messageInfo_DeprecatedResponse.Size(m)
-}
-func (m *DeprecatedResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_DeprecatedResponse.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_DeprecatedResponse proto.InternalMessageInfo
-
-// Deprecated: Do not use.
-func (m *DeprecatedResponse) GetDeprecatedField() DeprecatedEnum {
- if m != nil {
- return m.DeprecatedField
- }
- return DeprecatedEnum_DEPRECATED
-}
-
-func init() {
- proto.RegisterType((*DeprecatedRequest)(nil), "deprecated.DeprecatedRequest")
- proto.RegisterType((*DeprecatedResponse)(nil), "deprecated.DeprecatedResponse")
- proto.RegisterEnum("deprecated.DeprecatedEnum", DeprecatedEnum_name, DeprecatedEnum_value)
-}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
-
-// Client API for DeprecatedService service
-
-// Deprecated: Do not use.
-type DeprecatedServiceClient interface {
- // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
- DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error)
-}
-
-type deprecatedServiceClient struct {
- cc *grpc.ClientConn
-}
-
-// Deprecated: Do not use.
-func NewDeprecatedServiceClient(cc *grpc.ClientConn) DeprecatedServiceClient {
- return &deprecatedServiceClient{cc}
-}
-
-// Deprecated: Do not use.
-func (c *deprecatedServiceClient) DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) {
- out := new(DeprecatedResponse)
- err := grpc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for DeprecatedService service
-
-// Deprecated: Do not use.
-type DeprecatedServiceServer interface {
- // DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
- DeprecatedCall(context.Context, *DeprecatedRequest) (*DeprecatedResponse, error)
-}
-
-// Deprecated: Do not use.
-func RegisterDeprecatedServiceServer(s *grpc.Server, srv DeprecatedServiceServer) {
- s.RegisterService(&_DeprecatedService_serviceDesc, srv)
-}
-
-func _DeprecatedService_DeprecatedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeprecatedRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/deprecated.DeprecatedService/DeprecatedCall",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(DeprecatedServiceServer).DeprecatedCall(ctx, req.(*DeprecatedRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _DeprecatedService_serviceDesc = grpc.ServiceDesc{
- ServiceName: "deprecated.DeprecatedService",
- HandlerType: (*DeprecatedServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "DeprecatedCall",
- Handler: _DeprecatedService_DeprecatedCall_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "deprecated/deprecated.proto",
-}
diff --git a/protoc-gen-go/testdata/deprecated/deprecated.proto b/protoc-gen-go/testdata/deprecated/deprecated.proto
index 5ee932a..b314166 100644
--- a/protoc-gen-go/testdata/deprecated/deprecated.proto
+++ b/protoc-gen-go/testdata/deprecated/deprecated.proto
@@ -34,6 +34,8 @@
// package deprecated contains only deprecated messages and services.
package deprecated;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/deprecated";
+
option deprecated = true; // file-level deprecation
// DeprecatedRequest is a request to DeprecatedCall.
@@ -64,4 +66,4 @@
rpc DeprecatedCall(DeprecatedRequest) returns (DeprecatedResponse) {
option deprecated = true;
}
-}
\ No newline at end of file
+}
diff --git a/protoc-gen-go/testdata/extension_base/extension_base.pb.go b/protoc-gen-go/testdata/extension_base/extension_base.pb.go
new file mode 100644
index 0000000..be0cd7d
--- /dev/null
+++ b/protoc-gen-go/testdata/extension_base/extension_base.pb.go
@@ -0,0 +1,146 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: extension_base/extension_base.proto
+
+/*
+Package extension_base is a generated protocol buffer package.
+
+It is generated from these files:
+ extension_base/extension_base.proto
+
+It has these top-level messages:
+ BaseMessage
+ OldStyleMessage
+*/
+package extension_base
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// 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 BaseMessage struct {
+ Height *int32 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ proto.XXX_InternalExtensions `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *BaseMessage) Reset() { *m = BaseMessage{} }
+func (m *BaseMessage) String() string { return proto.CompactTextString(m) }
+func (*BaseMessage) ProtoMessage() {}
+func (*BaseMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+
+var extRange_BaseMessage = []proto.ExtensionRange{
+ {4, 9},
+ {16, 536870911},
+}
+
+func (*BaseMessage) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_BaseMessage
+}
+func (m *BaseMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_BaseMessage.Unmarshal(m, b)
+}
+func (m *BaseMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_BaseMessage.Marshal(b, m, deterministic)
+}
+func (dst *BaseMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_BaseMessage.Merge(dst, src)
+}
+func (m *BaseMessage) XXX_Size() int {
+ return xxx_messageInfo_BaseMessage.Size(m)
+}
+func (m *BaseMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_BaseMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BaseMessage proto.InternalMessageInfo
+
+func (m *BaseMessage) GetHeight() int32 {
+ if m != nil && m.Height != nil {
+ return *m.Height
+ }
+ return 0
+}
+
+// Another message that may be extended, using message_set_wire_format.
+type OldStyleMessage struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *OldStyleMessage) Reset() { *m = OldStyleMessage{} }
+func (m *OldStyleMessage) String() string { return proto.CompactTextString(m) }
+func (*OldStyleMessage) ProtoMessage() {}
+func (*OldStyleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+
+func (m *OldStyleMessage) MarshalJSON() ([]byte, error) {
+ return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
+}
+func (m *OldStyleMessage) UnmarshalJSON(buf []byte) error {
+ return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)
+}
+
+// ensure OldStyleMessage satisfies proto.Unmarshaler
+var _ proto.Unmarshaler = (*OldStyleMessage)(nil)
+
+var extRange_OldStyleMessage = []proto.ExtensionRange{
+ {100, 2147483646},
+}
+
+func (*OldStyleMessage) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_OldStyleMessage
+}
+func (m *OldStyleMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_OldStyleMessage.Unmarshal(m, b)
+}
+func (m *OldStyleMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_OldStyleMessage.Marshal(b, m, deterministic)
+}
+func (dst *OldStyleMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_OldStyleMessage.Merge(dst, src)
+}
+func (m *OldStyleMessage) XXX_Size() int {
+ return xxx_messageInfo_OldStyleMessage.Size(m)
+}
+func (m *OldStyleMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_OldStyleMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_OldStyleMessage proto.InternalMessageInfo
+
+func init() {
+ proto.RegisterType((*BaseMessage)(nil), "extension_base.BaseMessage")
+ proto.RegisterType((*OldStyleMessage)(nil), "extension_base.OldStyleMessage")
+}
+
+func init() { proto.RegisterFile("extension_base/extension_base.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 179 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xad, 0x28, 0x49,
+ 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x47, 0xe5, 0xea, 0x15, 0x14,
+ 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa1, 0x8a, 0x2a, 0x99, 0x72, 0x71, 0x3b, 0x25, 0x16, 0xa7, 0xfa,
+ 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x89, 0x71, 0xb1, 0x65, 0xa4, 0x66, 0xa6, 0x67, 0x94,
+ 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x06, 0x41, 0x79, 0x5a, 0x2c, 0x1c, 0x2c, 0x02, 0x5c, 0x5a,
+ 0x1c, 0x1c, 0x02, 0x02, 0x0d, 0x0d, 0x0d, 0x0d, 0x4c, 0x4a, 0xf2, 0x5c, 0xfc, 0xfe, 0x39, 0x29,
+ 0xc1, 0x25, 0x95, 0x39, 0x30, 0xad, 0x5a, 0x1c, 0x1c, 0x29, 0x02, 0xff, 0xff, 0xff, 0xff, 0xcf,
+ 0x6e, 0xc5, 0xc4, 0xc1, 0xe8, 0xe4, 0x14, 0xe5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97,
+ 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x0f, 0x76, 0x42, 0x52, 0x69, 0x1a,
+ 0x84, 0x91, 0xac, 0x9b, 0x9e, 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x5f, 0x92, 0x5a, 0x5c, 0x92, 0x92,
+ 0x58, 0x92, 0x88, 0xe6, 0x62, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x7f, 0xb7, 0x2a, 0xd1,
+ 0x00, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/extension_base.proto b/protoc-gen-go/testdata/extension_base/extension_base.proto
similarity index 95%
rename from protoc-gen-go/testdata/extension_base.proto
rename to protoc-gen-go/testdata/extension_base/extension_base.proto
index 94acfc1..0ba74de 100644
--- a/protoc-gen-go/testdata/extension_base.proto
+++ b/protoc-gen-go/testdata/extension_base/extension_base.proto
@@ -33,6 +33,8 @@
package extension_base;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base";
+
message BaseMessage {
optional int32 height = 1;
extensions 4 to 9;
diff --git a/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go
new file mode 100644
index 0000000..10b4caf
--- /dev/null
+++ b/protoc-gen-go/testdata/extension_extra/extension_extra.pb.go
@@ -0,0 +1,83 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: extension_extra/extension_extra.proto
+
+/*
+Package extension_extra is a generated protocol buffer package.
+
+It is generated from these files:
+ extension_extra/extension_extra.proto
+
+It has these top-level messages:
+ ExtraMessage
+*/
+package extension_extra
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// 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 ExtraMessage struct {
+ Width *int32 `protobuf:"varint,1,opt,name=width" json:"width,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ExtraMessage) Reset() { *m = ExtraMessage{} }
+func (m *ExtraMessage) String() string { return proto.CompactTextString(m) }
+func (*ExtraMessage) ProtoMessage() {}
+func (*ExtraMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *ExtraMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_ExtraMessage.Unmarshal(m, b)
+}
+func (m *ExtraMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ExtraMessage.Marshal(b, m, deterministic)
+}
+func (dst *ExtraMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ExtraMessage.Merge(dst, src)
+}
+func (m *ExtraMessage) XXX_Size() int {
+ return xxx_messageInfo_ExtraMessage.Size(m)
+}
+func (m *ExtraMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_ExtraMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ExtraMessage proto.InternalMessageInfo
+
+func (m *ExtraMessage) GetWidth() int32 {
+ if m != nil && m.Width != nil {
+ return *m.Width
+ }
+ return 0
+}
+
+func init() {
+ proto.RegisterType((*ExtraMessage)(nil), "extension_extra.ExtraMessage")
+}
+
+func init() { proto.RegisterFile("extension_extra/extension_extra.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 133 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x28, 0x49,
+ 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0xad, 0x28, 0x29, 0x4a, 0xd4, 0x47, 0xe3, 0xeb, 0x15,
+ 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xf1, 0xa3, 0x09, 0x2b, 0xa9, 0x70, 0xf1, 0xb8, 0x82, 0x18, 0xbe,
+ 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0xa9, 0x42, 0x22, 0x5c, 0xac, 0xe5, 0x99, 0x29, 0x25, 0x19, 0x12,
+ 0x8c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x93, 0x73, 0x94, 0x63, 0x7a, 0x66, 0x49, 0x46,
+ 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 0xba, 0x3e, 0xd8, 0xc4,
+ 0xa4, 0xd2, 0x34, 0x08, 0x23, 0x59, 0x37, 0x3d, 0x35, 0x4f, 0x37, 0x3d, 0x5f, 0xbf, 0x24, 0xb5,
+ 0xb8, 0x24, 0x25, 0xb1, 0x04, 0xc3, 0x05, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xec, 0xe3,
+ 0xb7, 0xa3, 0x00, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/extension_extra.proto b/protoc-gen-go/testdata/extension_extra/extension_extra.proto
similarity index 94%
rename from protoc-gen-go/testdata/extension_extra.proto
rename to protoc-gen-go/testdata/extension_extra/extension_extra.proto
index fca7f60..1dd03e7 100644
--- a/protoc-gen-go/testdata/extension_extra.proto
+++ b/protoc-gen-go/testdata/extension_extra/extension_extra.proto
@@ -33,6 +33,8 @@
package extension_extra;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra";
+
message ExtraMessage {
optional int32 width = 1;
}
diff --git a/protoc-gen-go/testdata/extension_test.go b/protoc-gen-go/testdata/extension_test.go
index 86e9c11..0524729 100644
--- a/protoc-gen-go/testdata/extension_test.go
+++ b/protoc-gen-go/testdata/extension_test.go
@@ -33,16 +33,14 @@
package testdata
-/*
-
import (
"bytes"
"regexp"
"testing"
"github.com/golang/protobuf/proto"
- base "extension_base.pb"
- user "extension_user.pb"
+ base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base"
+ user "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user"
)
func TestSingleFieldExtension(t *testing.T) {
@@ -206,5 +204,3 @@
[]testing.InternalBenchmark{},
[]testing.InternalExample{})
}
-
-*/
diff --git a/protoc-gen-go/testdata/extension_user/extension_user.pb.go b/protoc-gen-go/testdata/extension_user/extension_user.pb.go
new file mode 100644
index 0000000..f3c5f7d
--- /dev/null
+++ b/protoc-gen-go/testdata/extension_user/extension_user.pb.go
@@ -0,0 +1,400 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: extension_user/extension_user.proto
+
+/*
+Package extension_user is a generated protocol buffer package.
+
+It is generated from these files:
+ extension_user/extension_user.proto
+
+It has these top-level messages:
+ UserMessage
+ LoudMessage
+ LoginMessage
+ Detail
+ Announcement
+ OldStyleParcel
+*/
+package extension_user
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+import extension_base "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base"
+import extension_extra "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra"
+
+// 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 UserMessage struct {
+ Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+ Rank *string `protobuf:"bytes,2,opt,name=rank" json:"rank,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *UserMessage) Reset() { *m = UserMessage{} }
+func (m *UserMessage) String() string { return proto.CompactTextString(m) }
+func (*UserMessage) ProtoMessage() {}
+func (*UserMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *UserMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_UserMessage.Unmarshal(m, b)
+}
+func (m *UserMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_UserMessage.Marshal(b, m, deterministic)
+}
+func (dst *UserMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_UserMessage.Merge(dst, src)
+}
+func (m *UserMessage) XXX_Size() int {
+ return xxx_messageInfo_UserMessage.Size(m)
+}
+func (m *UserMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_UserMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UserMessage proto.InternalMessageInfo
+
+func (m *UserMessage) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
+ }
+ return ""
+}
+
+func (m *UserMessage) GetRank() string {
+ if m != nil && m.Rank != nil {
+ return *m.Rank
+ }
+ return ""
+}
+
+// Extend inside the scope of another type
+type LoudMessage struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ proto.XXX_InternalExtensions `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *LoudMessage) Reset() { *m = LoudMessage{} }
+func (m *LoudMessage) String() string { return proto.CompactTextString(m) }
+func (*LoudMessage) ProtoMessage() {}
+func (*LoudMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+
+var extRange_LoudMessage = []proto.ExtensionRange{
+ {100, 536870911},
+}
+
+func (*LoudMessage) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_LoudMessage
+}
+func (m *LoudMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_LoudMessage.Unmarshal(m, b)
+}
+func (m *LoudMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_LoudMessage.Marshal(b, m, deterministic)
+}
+func (dst *LoudMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_LoudMessage.Merge(dst, src)
+}
+func (m *LoudMessage) XXX_Size() int {
+ return xxx_messageInfo_LoudMessage.Size(m)
+}
+func (m *LoudMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_LoudMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LoudMessage proto.InternalMessageInfo
+
+var E_LoudMessage_Volume = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*uint32)(nil),
+ Field: 8,
+ Name: "extension_user.LoudMessage.volume",
+ Tag: "varint,8,opt,name=volume",
+ Filename: "extension_user/extension_user.proto",
+}
+
+// Extend inside the scope of another type, using a message.
+type LoginMessage struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *LoginMessage) Reset() { *m = LoginMessage{} }
+func (m *LoginMessage) String() string { return proto.CompactTextString(m) }
+func (*LoginMessage) ProtoMessage() {}
+func (*LoginMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *LoginMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_LoginMessage.Unmarshal(m, b)
+}
+func (m *LoginMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_LoginMessage.Marshal(b, m, deterministic)
+}
+func (dst *LoginMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_LoginMessage.Merge(dst, src)
+}
+func (m *LoginMessage) XXX_Size() int {
+ return xxx_messageInfo_LoginMessage.Size(m)
+}
+func (m *LoginMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_LoginMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LoginMessage proto.InternalMessageInfo
+
+var E_LoginMessage_UserMessage = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*UserMessage)(nil),
+ Field: 16,
+ Name: "extension_user.LoginMessage.user_message",
+ Tag: "bytes,16,opt,name=user_message,json=userMessage",
+ Filename: "extension_user/extension_user.proto",
+}
+
+type Detail struct {
+ Color *string `protobuf:"bytes,1,opt,name=color" json:"color,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Detail) Reset() { *m = Detail{} }
+func (m *Detail) String() string { return proto.CompactTextString(m) }
+func (*Detail) ProtoMessage() {}
+func (*Detail) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *Detail) Unmarshal(b []byte) error {
+ return xxx_messageInfo_Detail.Unmarshal(m, b)
+}
+func (m *Detail) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Detail.Marshal(b, m, deterministic)
+}
+func (dst *Detail) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Detail.Merge(dst, src)
+}
+func (m *Detail) XXX_Size() int {
+ return xxx_messageInfo_Detail.Size(m)
+}
+func (m *Detail) XXX_DiscardUnknown() {
+ xxx_messageInfo_Detail.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Detail proto.InternalMessageInfo
+
+func (m *Detail) GetColor() string {
+ if m != nil && m.Color != nil {
+ return *m.Color
+ }
+ return ""
+}
+
+// An extension of an extension
+type Announcement struct {
+ Words *string `protobuf:"bytes,1,opt,name=words" json:"words,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Announcement) Reset() { *m = Announcement{} }
+func (m *Announcement) String() string { return proto.CompactTextString(m) }
+func (*Announcement) ProtoMessage() {}
+func (*Announcement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *Announcement) Unmarshal(b []byte) error {
+ return xxx_messageInfo_Announcement.Unmarshal(m, b)
+}
+func (m *Announcement) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Announcement.Marshal(b, m, deterministic)
+}
+func (dst *Announcement) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Announcement.Merge(dst, src)
+}
+func (m *Announcement) XXX_Size() int {
+ return xxx_messageInfo_Announcement.Size(m)
+}
+func (m *Announcement) XXX_DiscardUnknown() {
+ xxx_messageInfo_Announcement.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Announcement proto.InternalMessageInfo
+
+func (m *Announcement) GetWords() string {
+ if m != nil && m.Words != nil {
+ return *m.Words
+ }
+ return ""
+}
+
+var E_Announcement_LoudExt = &proto.ExtensionDesc{
+ ExtendedType: (*LoudMessage)(nil),
+ ExtensionType: (*Announcement)(nil),
+ Field: 100,
+ Name: "extension_user.Announcement.loud_ext",
+ Tag: "bytes,100,opt,name=loud_ext,json=loudExt",
+ Filename: "extension_user/extension_user.proto",
+}
+
+// Something that can be put in a message set.
+type OldStyleParcel struct {
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ Height *int32 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *OldStyleParcel) Reset() { *m = OldStyleParcel{} }
+func (m *OldStyleParcel) String() string { return proto.CompactTextString(m) }
+func (*OldStyleParcel) ProtoMessage() {}
+func (*OldStyleParcel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (m *OldStyleParcel) Unmarshal(b []byte) error {
+ return xxx_messageInfo_OldStyleParcel.Unmarshal(m, b)
+}
+func (m *OldStyleParcel) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_OldStyleParcel.Marshal(b, m, deterministic)
+}
+func (dst *OldStyleParcel) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_OldStyleParcel.Merge(dst, src)
+}
+func (m *OldStyleParcel) XXX_Size() int {
+ return xxx_messageInfo_OldStyleParcel.Size(m)
+}
+func (m *OldStyleParcel) XXX_DiscardUnknown() {
+ xxx_messageInfo_OldStyleParcel.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_OldStyleParcel proto.InternalMessageInfo
+
+func (m *OldStyleParcel) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
+ }
+ return ""
+}
+
+func (m *OldStyleParcel) GetHeight() int32 {
+ if m != nil && m.Height != nil {
+ return *m.Height
+ }
+ return 0
+}
+
+var E_OldStyleParcel_MessageSetExtension = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.OldStyleMessage)(nil),
+ ExtensionType: (*OldStyleParcel)(nil),
+ Field: 2001,
+ Name: "extension_user.OldStyleParcel.message_set_extension",
+ Tag: "bytes,2001,opt,name=message_set_extension,json=messageSetExtension",
+ Filename: "extension_user/extension_user.proto",
+}
+
+var E_UserMessage = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*UserMessage)(nil),
+ Field: 5,
+ Name: "extension_user.user_message",
+ Tag: "bytes,5,opt,name=user_message,json=userMessage",
+ Filename: "extension_user/extension_user.proto",
+}
+
+var E_ExtraMessage = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*extension_extra.ExtraMessage)(nil),
+ Field: 9,
+ Name: "extension_user.extra_message",
+ Tag: "bytes,9,opt,name=extra_message,json=extraMessage",
+ Filename: "extension_user/extension_user.proto",
+}
+
+var E_Width = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*int32)(nil),
+ Field: 6,
+ Name: "extension_user.width",
+ Tag: "varint,6,opt,name=width",
+ Filename: "extension_user/extension_user.proto",
+}
+
+var E_Area = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: (*int64)(nil),
+ Field: 7,
+ Name: "extension_user.area",
+ Tag: "varint,7,opt,name=area",
+ Filename: "extension_user/extension_user.proto",
+}
+
+var E_Detail = &proto.ExtensionDesc{
+ ExtendedType: (*extension_base.BaseMessage)(nil),
+ ExtensionType: ([]*Detail)(nil),
+ Field: 17,
+ Name: "extension_user.detail",
+ Tag: "bytes,17,rep,name=detail",
+ Filename: "extension_user/extension_user.proto",
+}
+
+func init() {
+ proto.RegisterType((*UserMessage)(nil), "extension_user.UserMessage")
+ proto.RegisterType((*LoudMessage)(nil), "extension_user.LoudMessage")
+ proto.RegisterType((*LoginMessage)(nil), "extension_user.LoginMessage")
+ proto.RegisterType((*Detail)(nil), "extension_user.Detail")
+ proto.RegisterType((*Announcement)(nil), "extension_user.Announcement")
+ proto.RegisterType((*OldStyleParcel)(nil), "extension_user.OldStyleParcel")
+ proto.RegisterExtension(E_LoudMessage_Volume)
+ proto.RegisterExtension(E_LoginMessage_UserMessage)
+ proto.RegisterExtension(E_Announcement_LoudExt)
+ proto.RegisterExtension(E_OldStyleParcel_MessageSetExtension)
+ proto.RegisterExtension(E_UserMessage)
+ proto.RegisterExtension(E_ExtraMessage)
+ proto.RegisterExtension(E_Width)
+ proto.RegisterExtension(E_Area)
+ proto.RegisterExtension(E_Detail)
+}
+
+func init() { proto.RegisterFile("extension_user/extension_user.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 492 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x6f, 0x94, 0x40,
+ 0x10, 0x0e, 0x6d, 0x8f, 0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0xc7, 0x93, 0xfe, 0xae, 0xcf,
+ 0xea, 0x67, 0xab, 0x3f, 0xc2, 0x0e, 0x0a, 0x5f, 0xc0, 0xe0, 0x2a, 0x4f, 0xe5, 0x72, 0xbb, 0xb0,
+ 0xa9, 0x7c, 0x6e, 0x98, 0xa1, 0x0f, 0x7b, 0x84, 0x23, 0xd9, 0x9e, 0xb1, 0xef, 0x18, 0xde, 0x6e,
+ 0xa4, 0x88, 0xe1, 0x3b, 0x30, 0xd3, 0x66, 0xe5, 0xb6, 0xa6, 0xdc, 0x75, 0x76, 0x3d, 0x2b, 0x38,
+ 0xe9, 0x7b, 0xd3, 0x6c, 0x6b, 0xa4, 0x25, 0xa6, 0xd3, 0x2f, 0xaf, 0xb3, 0x5c, 0x2e, 0xab, 0xc5,
+ 0x24, 0x61, 0xa5, 0x9f, 0xb1, 0x82, 0xd0, 0xcc, 0x57, 0x1f, 0xf3, 0xa2, 0xfa, 0xd6, 0x1c, 0x92,
+ 0xf3, 0x0c, 0xe9, 0x79, 0xc6, 0x7c, 0x89, 0x42, 0xa6, 0x44, 0x92, 0xde, 0x7f, 0xe5, 0x6f, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xdf, 0x18, 0x64, 0x15, 0x77, 0x04, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/extension_user.proto b/protoc-gen-go/testdata/extension_user/extension_user.proto
similarity index 94%
rename from protoc-gen-go/testdata/extension_user.proto
rename to protoc-gen-go/testdata/extension_user/extension_user.proto
index ff65873..033c186 100644
--- a/protoc-gen-go/testdata/extension_user.proto
+++ b/protoc-gen-go/testdata/extension_user/extension_user.proto
@@ -31,11 +31,13 @@
syntax = "proto2";
-import "extension_base.proto";
-import "extension_extra.proto";
+import "extension_base/extension_base.proto";
+import "extension_extra/extension_extra.proto";
package extension_user;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user";
+
message UserMessage {
optional string name = 1;
optional string rank = 2;
diff --git a/protoc-gen-go/testdata/grpc/grpc.pb.go b/protoc-gen-go/testdata/grpc/grpc.pb.go
new file mode 100644
index 0000000..cc1b59d
--- /dev/null
+++ b/protoc-gen-go/testdata/grpc/grpc.pb.go
@@ -0,0 +1,172 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: grpc/grpc.proto
+
+/*
+Package testing is a generated protocol buffer package.
+
+It is generated from these files:
+ grpc/grpc.proto
+
+It has these top-level messages:
+ SimpleRequest
+ SimpleResponse
+ StreamMsg
+ StreamMsg2
+*/
+package testing
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// 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 SimpleRequest struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
+func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
+func (*SimpleRequest) ProtoMessage() {}
+func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *SimpleRequest) Unmarshal(b []byte) error {
+ return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
+}
+func (m *SimpleRequest) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic)
+}
+func (dst *SimpleRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SimpleRequest.Merge(dst, src)
+}
+func (m *SimpleRequest) XXX_Size() int {
+ return xxx_messageInfo_SimpleRequest.Size(m)
+}
+func (m *SimpleRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_SimpleRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo
+
+type SimpleResponse struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
+func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
+func (*SimpleResponse) ProtoMessage() {}
+func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *SimpleResponse) Unmarshal(b []byte) error {
+ return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
+}
+func (m *SimpleResponse) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic)
+}
+func (dst *SimpleResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SimpleResponse.Merge(dst, src)
+}
+func (m *SimpleResponse) XXX_Size() int {
+ return xxx_messageInfo_SimpleResponse.Size(m)
+}
+func (m *SimpleResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_SimpleResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo
+
+type StreamMsg struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *StreamMsg) Reset() { *m = StreamMsg{} }
+func (m *StreamMsg) String() string { return proto.CompactTextString(m) }
+func (*StreamMsg) ProtoMessage() {}
+func (*StreamMsg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *StreamMsg) Unmarshal(b []byte) error {
+ return xxx_messageInfo_StreamMsg.Unmarshal(m, b)
+}
+func (m *StreamMsg) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_StreamMsg.Marshal(b, m, deterministic)
+}
+func (dst *StreamMsg) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_StreamMsg.Merge(dst, src)
+}
+func (m *StreamMsg) XXX_Size() int {
+ return xxx_messageInfo_StreamMsg.Size(m)
+}
+func (m *StreamMsg) XXX_DiscardUnknown() {
+ xxx_messageInfo_StreamMsg.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_StreamMsg proto.InternalMessageInfo
+
+type StreamMsg2 struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *StreamMsg2) Reset() { *m = StreamMsg2{} }
+func (m *StreamMsg2) String() string { return proto.CompactTextString(m) }
+func (*StreamMsg2) ProtoMessage() {}
+func (*StreamMsg2) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *StreamMsg2) Unmarshal(b []byte) error {
+ return xxx_messageInfo_StreamMsg2.Unmarshal(m, b)
+}
+func (m *StreamMsg2) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_StreamMsg2.Marshal(b, m, deterministic)
+}
+func (dst *StreamMsg2) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_StreamMsg2.Merge(dst, src)
+}
+func (m *StreamMsg2) XXX_Size() int {
+ return xxx_messageInfo_StreamMsg2.Size(m)
+}
+func (m *StreamMsg2) XXX_DiscardUnknown() {
+ xxx_messageInfo_StreamMsg2.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo
+
+func init() {
+ proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest")
+ proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse")
+ proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg")
+ proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2")
+}
+
+func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 244 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x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, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf,
+ 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e,
+ 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50,
+ 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42,
+ 0xc2, 0x01, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/grpc.proto b/protoc-gen-go/testdata/grpc/grpc.proto
similarity index 95%
rename from protoc-gen-go/testdata/grpc.proto
rename to protoc-gen-go/testdata/grpc/grpc.proto
index b8bc41a..0e5c64a 100644
--- a/protoc-gen-go/testdata/grpc.proto
+++ b/protoc-gen-go/testdata/grpc/grpc.proto
@@ -33,6 +33,8 @@
package grpc.testing;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc;testing";
+
message SimpleRequest {
}
diff --git a/protoc-gen-go/testdata/imp.pb.go.golden b/protoc-gen-go/testdata/imp.pb.go.golden
deleted file mode 100644
index 784a4f8..0000000
--- a/protoc-gen-go/testdata/imp.pb.go.golden
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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)
-}
diff --git a/protoc-gen-go/testdata/imp/imp.pb.go b/protoc-gen-go/testdata/imp/imp.pb.go
new file mode 100644
index 0000000..6a2c2c3
--- /dev/null
+++ b/protoc-gen-go/testdata/imp/imp.pb.go
@@ -0,0 +1,363 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: imp/imp.proto
+
+/*
+Package imp is a generated protocol buffer package.
+
+It is generated from these files:
+ imp/imp.proto
+ imp/imp2.proto
+ imp/imp3.proto
+
+It has these top-level messages:
+ ImportedMessage
+ ImportedMessage2
+ ImportedExtendable
+ PubliclyImportedMessage
+ ForeignImportedMessage
+*/
+package imp
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// 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 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,
+}
+
+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))
+}
+func (x *ImportedMessage_Owner) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(ImportedMessage_Owner_value, data, "ImportedMessage_Owner")
+ if err != nil {
+ return err
+ }
+ *x = ImportedMessage_Owner(value)
+ return nil
+}
+func (ImportedMessage_Owner) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+
+type ImportedMessage struct {
+ Field *int64 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
+ // The forwarded getters for these fields are fiddly to get right.
+ LocalMsg *ImportedMessage2 `protobuf:"bytes,2,opt,name=local_msg,json=localMsg" json:"local_msg,omitempty"`
+ ForeignMsg *ForeignImportedMessage `protobuf:"bytes,3,opt,name=foreign_msg,json=foreignMsg" json:"foreign_msg,omitempty"`
+ EnumField *ImportedMessage_Owner `protobuf:"varint,4,opt,name=enum_field,json=enumField,enum=imp.ImportedMessage_Owner" json:"enum_field,omitempty"`
+ // Types that are valid to be assigned to Union:
+ // *ImportedMessage_State
+ Union isImportedMessage_Union `protobuf_oneof:"union"`
+ Name []string `protobuf:"bytes,5,rep,name=name" json:"name,omitempty"`
+ Boss []ImportedMessage_Owner `protobuf:"varint,6,rep,name=boss,enum=imp.ImportedMessage_Owner" json:"boss,omitempty"`
+ Memo []*ImportedMessage2 `protobuf:"bytes,7,rep,name=memo" json:"memo,omitempty"`
+ MsgMap map[string]*ImportedMessage2 `protobuf:"bytes,8,rep,name=msg_map,json=msgMap" json:"msg_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ proto.XXX_InternalExtensions `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ImportedMessage) Reset() { *m = ImportedMessage{} }
+func (m *ImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*ImportedMessage) ProtoMessage() {}
+func (*ImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+
+var extRange_ImportedMessage = []proto.ExtensionRange{
+ {90, 100},
+}
+
+func (*ImportedMessage) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_ImportedMessage
+}
+func (m *ImportedMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_ImportedMessage.Unmarshal(m, b)
+}
+func (m *ImportedMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ImportedMessage.Marshal(b, m, deterministic)
+}
+func (dst *ImportedMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ImportedMessage.Merge(dst, src)
+}
+func (m *ImportedMessage) XXX_Size() int {
+ return xxx_messageInfo_ImportedMessage.Size(m)
+}
+func (m *ImportedMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_ImportedMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ImportedMessage proto.InternalMessageInfo
+
+type isImportedMessage_Union interface {
+ isImportedMessage_Union()
+}
+
+type ImportedMessage_State struct {
+ State int32 `protobuf:"varint,9,opt,name=state,oneof"`
+}
+
+func (*ImportedMessage_State) isImportedMessage_Union() {}
+
+func (m *ImportedMessage) GetUnion() isImportedMessage_Union {
+ if m != nil {
+ return m.Union
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetField() int64 {
+ if m != nil && m.Field != nil {
+ return *m.Field
+ }
+ return 0
+}
+
+func (m *ImportedMessage) GetLocalMsg() *ImportedMessage2 {
+ if m != nil {
+ return m.LocalMsg
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetForeignMsg() *ForeignImportedMessage {
+ if m != nil {
+ return m.ForeignMsg
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetEnumField() ImportedMessage_Owner {
+ if m != nil && m.EnumField != nil {
+ return *m.EnumField
+ }
+ return ImportedMessage_DAVE
+}
+
+func (m *ImportedMessage) GetState() int32 {
+ if x, ok := m.GetUnion().(*ImportedMessage_State); ok {
+ return x.State
+ }
+ return 0
+}
+
+func (m *ImportedMessage) GetName() []string {
+ if m != nil {
+ return m.Name
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetBoss() []ImportedMessage_Owner {
+ if m != nil {
+ return m.Boss
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetMemo() []*ImportedMessage2 {
+ if m != nil {
+ return m.Memo
+ }
+ return nil
+}
+
+func (m *ImportedMessage) GetMsgMap() map[string]*ImportedMessage2 {
+ if m != nil {
+ return m.MsgMap
+ }
+ return nil
+}
+
+// XXX_OneofFuncs is for the internal use of the proto package.
+func (*ImportedMessage) 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 _ImportedMessage_OneofMarshaler, _ImportedMessage_OneofUnmarshaler, _ImportedMessage_OneofSizer, []interface{}{
+ (*ImportedMessage_State)(nil),
+ }
+}
+
+func _ImportedMessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
+ m := msg.(*ImportedMessage)
+ // union
+ switch x := m.Union.(type) {
+ case *ImportedMessage_State:
+ b.EncodeVarint(9<<3 | proto.WireVarint)
+ b.EncodeVarint(uint64(x.State))
+ case nil:
+ default:
+ return fmt.Errorf("ImportedMessage.Union has unexpected type %T", x)
+ }
+ return nil
+}
+
+func _ImportedMessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
+ m := msg.(*ImportedMessage)
+ switch tag {
+ case 9: // union.state
+ if wire != proto.WireVarint {
+ return true, proto.ErrInternalBadWireType
+ }
+ x, err := b.DecodeVarint()
+ m.Union = &ImportedMessage_State{int32(x)}
+ return true, err
+ default:
+ return false, nil
+ }
+}
+
+func _ImportedMessage_OneofSizer(msg proto.Message) (n int) {
+ m := msg.(*ImportedMessage)
+ // union
+ switch x := m.Union.(type) {
+ case *ImportedMessage_State:
+ n += proto.SizeVarint(9<<3 | proto.WireVarint)
+ n += proto.SizeVarint(uint64(x.State))
+ case nil:
+ default:
+ panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
+ }
+ return n
+}
+
+type ImportedMessage2 struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ImportedMessage2) Reset() { *m = ImportedMessage2{} }
+func (m *ImportedMessage2) String() string { return proto.CompactTextString(m) }
+func (*ImportedMessage2) ProtoMessage() {}
+func (*ImportedMessage2) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *ImportedMessage2) Unmarshal(b []byte) error {
+ return xxx_messageInfo_ImportedMessage2.Unmarshal(m, b)
+}
+func (m *ImportedMessage2) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ImportedMessage2.Marshal(b, m, deterministic)
+}
+func (dst *ImportedMessage2) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ImportedMessage2.Merge(dst, src)
+}
+func (m *ImportedMessage2) XXX_Size() int {
+ return xxx_messageInfo_ImportedMessage2.Size(m)
+}
+func (m *ImportedMessage2) XXX_DiscardUnknown() {
+ xxx_messageInfo_ImportedMessage2.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ImportedMessage2 proto.InternalMessageInfo
+
+type ImportedExtendable struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ImportedExtendable) Reset() { *m = ImportedExtendable{} }
+func (m *ImportedExtendable) String() string { return proto.CompactTextString(m) }
+func (*ImportedExtendable) ProtoMessage() {}
+func (*ImportedExtendable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+
+func (m *ImportedExtendable) MarshalJSON() ([]byte, error) {
+ return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
+}
+func (m *ImportedExtendable) UnmarshalJSON(buf []byte) error {
+ return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)
+}
+
+// ensure ImportedExtendable satisfies proto.Unmarshaler
+var _ proto.Unmarshaler = (*ImportedExtendable)(nil)
+
+var extRange_ImportedExtendable = []proto.ExtensionRange{
+ {100, 2147483646},
+}
+
+func (*ImportedExtendable) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_ImportedExtendable
+}
+func (m *ImportedExtendable) Unmarshal(b []byte) error {
+ return xxx_messageInfo_ImportedExtendable.Unmarshal(m, b)
+}
+func (m *ImportedExtendable) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ImportedExtendable.Marshal(b, m, deterministic)
+}
+func (dst *ImportedExtendable) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ImportedExtendable.Merge(dst, src)
+}
+func (m *ImportedExtendable) XXX_Size() int {
+ return xxx_messageInfo_ImportedExtendable.Size(m)
+}
+func (m *ImportedExtendable) XXX_DiscardUnknown() {
+ xxx_messageInfo_ImportedExtendable.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ImportedExtendable proto.InternalMessageInfo
+
+func init() {
+ proto.RegisterType((*ImportedMessage)(nil), "imp.ImportedMessage")
+ proto.RegisterMapType((map[string]*ImportedMessage2)(nil), "imp.ImportedMessage.MsgMapEntry")
+ proto.RegisterType((*ImportedMessage2)(nil), "imp.ImportedMessage2")
+ proto.RegisterType((*ImportedExtendable)(nil), "imp.ImportedExtendable")
+ proto.RegisterEnum("imp.ImportedMessage_Owner", ImportedMessage_Owner_name, ImportedMessage_Owner_value)
+}
+
+func init() { proto.RegisterFile("imp/imp.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 421 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x8b, 0xd4, 0x30,
+ 0x18, 0xc6, 0x4d, 0xff, 0xec, 0xb4, 0xef, 0xe0, 0x5a, 0x82, 0x4a, 0x99, 0xbd, 0x84, 0x9e, 0xea,
+ 0xca, 0x76, 0xa0, 0x22, 0xba, 0x8b, 0x17, 0x17, 0x67, 0x71, 0x91, 0xa2, 0xf4, 0xe0, 0x61, 0x2f,
+ 0x43, 0x66, 0x9a, 0x89, 0xc5, 0x26, 0x29, 0x4d, 0xaa, 0xee, 0xf7, 0xf0, 0xfb, 0x56, 0x9a, 0xae,
+ 0x22, 0xc3, 0xe8, 0xde, 0x9e, 0xe7, 0xe1, 0xf7, 0xe4, 0x4d, 0x9b, 0x17, 0x1e, 0xd6, 0xa2, 0x5d,
+ 0xd6, 0xa2, 0xcd, 0xda, 0x4e, 0x19, 0x85, 0xdd, 0x5a, 0xb4, 0x8b, 0xe3, 0xbb, 0x2c, 0x9f, 0xc2,
+ 0x3f, 0xfe, 0xc5, 0xe4, 0x93, 0x9f, 0x1e, 0x3c, 0xba, 0x16, 0xad, 0xea, 0x0c, 0xab, 0x0a, 0xa6,
+ 0x35, 0xe5, 0x0c, 0x3f, 0x06, 0x7f, 0x57, 0xb3, 0xa6, 0x8a, 0x11, 0x71, 0x52, 0xb7, 0x9c, 0x0c,
+ 0xce, 0x21, 0x6c, 0xd4, 0x96, 0x36, 0x6b, 0xa1, 0x79, 0xec, 0x10, 0x94, 0xce, 0xf3, 0x27, 0xd9,
+ 0x38, 0x6d, 0xaf, 0x9e, 0x97, 0x81, 0xe5, 0x0a, 0xcd, 0xf1, 0x1b, 0x98, 0xef, 0x54, 0xc7, 0x6a,
+ 0x2e, 0x6d, 0xcb,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 0xc1, 0x10, 0xed, 0x1f, 0x95, 0x24, 0x80, 0x7f, 0x67, 0xab,
+ 0x1f, 0x86, 0xc9, 0x8a, 0x6e, 0x1a, 0x76, 0x1a, 0x04, 0x55, 0x34, 0x0c, 0xc3, 0x30, 0xbb, 0x70,
+ 0x02, 0x74, 0xf9, 0xea, 0xe6, 0x25, 0xaf, 0xcd, 0x97, 0x7e, 0x93, 0x6d, 0x95, 0x58, 0x72, 0xd5,
+ 0x50, 0xc9, 0x97, 0x76, 0xd3, 0x36, 0xfd, 0x6e, 0x12, 0xdb, 0x33, 0xce, 0xe4, 0x19, 0x57, 0x4b,
+ 0xc3, 0xb4, 0xa9, 0xa8, 0xa1, 0xe3, 0x3a, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xe4, 0x5b,
+ 0xa3, 0xbc, 0x02, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/imp.proto b/protoc-gen-go/testdata/imp/imp.proto
similarity index 94%
rename from protoc-gen-go/testdata/imp.proto
rename to protoc-gen-go/testdata/imp/imp.proto
index 156e078..924b99d 100644
--- a/protoc-gen-go/testdata/imp.proto
+++ b/protoc-gen-go/testdata/imp/imp.proto
@@ -33,8 +33,10 @@
package imp;
-import "imp2.proto";
-import "imp3.proto";
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imp";
+
+import "imp/imp2.proto";
+import "imp/imp3.proto";
message ImportedMessage {
required int64 field = 1;
diff --git a/protoc-gen-go/testdata/imp/imp2.pb.go b/protoc-gen-go/testdata/imp/imp2.pb.go
new file mode 100644
index 0000000..b45cae7
--- /dev/null
+++ b/protoc-gen-go/testdata/imp/imp2.pb.go
@@ -0,0 +1,105 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: imp/imp2.proto
+
+package imp
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+type PubliclyImportedEnum int32
+
+const (
+ PubliclyImportedEnum_GLASSES PubliclyImportedEnum = 1
+ PubliclyImportedEnum_HAIR PubliclyImportedEnum = 2
+)
+
+var PubliclyImportedEnum_name = map[int32]string{
+ 1: "GLASSES",
+ 2: "HAIR",
+}
+var PubliclyImportedEnum_value = map[string]int32{
+ "GLASSES": 1,
+ "HAIR": 2,
+}
+
+func (x PubliclyImportedEnum) Enum() *PubliclyImportedEnum {
+ p := new(PubliclyImportedEnum)
+ *p = x
+ return p
+}
+func (x PubliclyImportedEnum) String() string {
+ return proto.EnumName(PubliclyImportedEnum_name, int32(x))
+}
+func (x *PubliclyImportedEnum) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(PubliclyImportedEnum_value, data, "PubliclyImportedEnum")
+ if err != nil {
+ return err
+ }
+ *x = PubliclyImportedEnum(value)
+ return nil
+}
+func (PubliclyImportedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+
+type PubliclyImportedMessage struct {
+ Field *int64 `protobuf:"varint,1,opt,name=field" json:"field,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PubliclyImportedMessage) Reset() { *m = PubliclyImportedMessage{} }
+func (m *PubliclyImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*PubliclyImportedMessage) ProtoMessage() {}
+func (*PubliclyImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *PubliclyImportedMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_PubliclyImportedMessage.Unmarshal(m, b)
+}
+func (m *PubliclyImportedMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PubliclyImportedMessage.Marshal(b, m, deterministic)
+}
+func (dst *PubliclyImportedMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PubliclyImportedMessage.Merge(dst, src)
+}
+func (m *PubliclyImportedMessage) XXX_Size() int {
+ return xxx_messageInfo_PubliclyImportedMessage.Size(m)
+}
+func (m *PubliclyImportedMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_PubliclyImportedMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PubliclyImportedMessage proto.InternalMessageInfo
+
+func (m *PubliclyImportedMessage) GetField() int64 {
+ if m != nil && m.Field != nil {
+ return *m.Field
+ }
+ return 0
+}
+
+func init() {
+ proto.RegisterType((*PubliclyImportedMessage)(nil), "imp.PubliclyImportedMessage")
+ proto.RegisterEnum("imp.PubliclyImportedEnum", PubliclyImportedEnum_name, PubliclyImportedEnum_value)
+}
+
+func init() { proto.RegisterFile("imp/imp2.proto", fileDescriptor1) }
+
+var fileDescriptor1 = []byte{
+ // 171 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0xcc, 0x2d, 0xd0,
+ 0xcf, 0xcc, 0x2d, 0x30, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xce, 0xcc, 0x2d, 0x50,
+ 0xd2, 0xe7, 0x12, 0x0f, 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xce, 0xa9, 0xf4, 0xcc, 0x2d, 0xc8, 0x2f,
+ 0x2a, 0x49, 0x4d, 0xf1, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0x12, 0xe1, 0x62, 0x4d, 0xcb,
+ 0x4c, 0xcd, 0x49, 0x91, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0e, 0x82, 0x70, 0xb4, 0x74, 0xb9, 0x44,
+ 0xd0, 0x35, 0xb8, 0xe6, 0x95, 0xe6, 0x0a, 0x71, 0x73, 0xb1, 0xbb, 0xfb, 0x38, 0x06, 0x07, 0xbb,
+ 0x06, 0x0b, 0x30, 0x0a, 0x71, 0x70, 0xb1, 0x78, 0x38, 0x7a, 0x06, 0x09, 0x30, 0x39, 0x99, 0x47,
+ 0x99, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xe7, 0x24,
+ 0xe6, 0xa5, 0xeb, 0x83, 0xed, 0x4f, 0x2a, 0x4d, 0x83, 0x30, 0x92, 0x75, 0xd3, 0x53, 0xf3, 0x74,
+ 0xd3, 0xf3, 0xf5, 0x4b, 0x52, 0x8b, 0x4b, 0x52, 0x12, 0x4b, 0x12, 0x41, 0x8e, 0x04, 0x04, 0x00,
+ 0x00, 0xff, 0xff, 0x32, 0x18, 0x4d, 0x15, 0xae, 0x00, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/imp2.proto b/protoc-gen-go/testdata/imp/imp2.proto
similarity index 95%
rename from protoc-gen-go/testdata/imp2.proto
rename to protoc-gen-go/testdata/imp/imp2.proto
index 3bb0632..ee67fb9 100644
--- a/protoc-gen-go/testdata/imp2.proto
+++ b/protoc-gen-go/testdata/imp/imp2.proto
@@ -33,6 +33,8 @@
package imp;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imp";
+
message PubliclyImportedMessage {
optional int64 field = 1;
}
diff --git a/protoc-gen-go/testdata/imp/imp3.pb.go b/protoc-gen-go/testdata/imp/imp3.pb.go
new file mode 100644
index 0000000..ea0b981
--- /dev/null
+++ b/protoc-gen-go/testdata/imp/imp3.pb.go
@@ -0,0 +1,68 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: imp/imp3.proto
+
+package imp
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+type ForeignImportedMessage struct {
+ Tuber *string `protobuf:"bytes,1,opt,name=tuber" json:"tuber,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ForeignImportedMessage) Reset() { *m = ForeignImportedMessage{} }
+func (m *ForeignImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*ForeignImportedMessage) ProtoMessage() {}
+func (*ForeignImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
+func (m *ForeignImportedMessage) Unmarshal(b []byte) error {
+ return xxx_messageInfo_ForeignImportedMessage.Unmarshal(m, b)
+}
+func (m *ForeignImportedMessage) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ForeignImportedMessage.Marshal(b, m, deterministic)
+}
+func (dst *ForeignImportedMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ForeignImportedMessage.Merge(dst, src)
+}
+func (m *ForeignImportedMessage) XXX_Size() int {
+ return xxx_messageInfo_ForeignImportedMessage.Size(m)
+}
+func (m *ForeignImportedMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_ForeignImportedMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ForeignImportedMessage proto.InternalMessageInfo
+
+func (m *ForeignImportedMessage) GetTuber() string {
+ if m != nil && m.Tuber != nil {
+ return *m.Tuber
+ }
+ return ""
+}
+
+func init() {
+ proto.RegisterType((*ForeignImportedMessage)(nil), "imp.ForeignImportedMessage")
+}
+
+func init() { proto.RegisterFile("imp/imp3.proto", fileDescriptor2) }
+
+var fileDescriptor2 = []byte{
+ // 137 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0xcc, 0x2d, 0xd0,
+ 0xcf, 0xcc, 0x2d, 0x30, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xce, 0xcc, 0x2d, 0x50,
+ 0xd2, 0xe3, 0x12, 0x73, 0xcb, 0x2f, 0x4a, 0xcd, 0x4c, 0xcf, 0xf3, 0xcc, 0x2d, 0xc8, 0x2f, 0x2a,
+ 0x49, 0x4d, 0xf1, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x29, 0x4d,
+ 0x4a, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x9c, 0xcc, 0xa3, 0x4c, 0xd3,
+ 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2,
+ 0xf5, 0xc1, 0xe6, 0x25, 0x95, 0xa6, 0x41, 0x18, 0xc9, 0xba, 0xe9, 0xa9, 0x79, 0xba, 0xe9, 0xf9,
+ 0xfa, 0x25, 0xa9, 0xc5, 0x25, 0x29, 0x89, 0x25, 0x89, 0x20, 0x4b, 0x01, 0x01, 0x00, 0x00, 0xff,
+ 0xff, 0xa9, 0xbf, 0xbe, 0xdc, 0x7e, 0x00, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/imp3.proto b/protoc-gen-go/testdata/imp/imp3.proto
similarity index 95%
rename from protoc-gen-go/testdata/imp3.proto
rename to protoc-gen-go/testdata/imp/imp3.proto
index 58fc759..2aed1d5 100644
--- a/protoc-gen-go/testdata/imp3.proto
+++ b/protoc-gen-go/testdata/imp/imp3.proto
@@ -33,6 +33,8 @@
package imp;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/imp";
+
message ForeignImportedMessage {
optional string tuber = 1;
}
diff --git a/protoc-gen-go/testdata/multi/multi1.proto b/protoc-gen-go/testdata/multi/multi1.proto
index 0da6e0a..d3a3204 100644
--- a/protoc-gen-go/testdata/multi/multi1.proto
+++ b/protoc-gen-go/testdata/multi/multi1.proto
@@ -36,6 +36,8 @@
package multitest;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest";
+
message Multi1 {
required Multi2 multi2 = 1;
optional Multi2.Color color = 2;
diff --git a/protoc-gen-go/testdata/multi/multi2.proto b/protoc-gen-go/testdata/multi/multi2.proto
index e6bfc71..ec5b431 100644
--- a/protoc-gen-go/testdata/multi/multi2.proto
+++ b/protoc-gen-go/testdata/multi/multi2.proto
@@ -33,6 +33,8 @@
package multitest;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest";
+
message Multi2 {
required int32 required_value = 1;
diff --git a/protoc-gen-go/testdata/multi/multi3.proto b/protoc-gen-go/testdata/multi/multi3.proto
index 146c255..8690b88 100644
--- a/protoc-gen-go/testdata/multi/multi3.proto
+++ b/protoc-gen-go/testdata/multi/multi3.proto
@@ -33,6 +33,8 @@
package multitest;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/multi;multitest";
+
message Multi3 {
enum HatType {
FEDORA = 1;
diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go
index 4afe896..deba6d1 100644
--- a/protoc-gen-go/testdata/my_test/test.pb.go
+++ b/protoc-gen-go/testdata/my_test/test.pb.go
@@ -2,7 +2,7 @@
// source: my_test/test.proto
/*
-Package my_test is a generated protocol buffer package.
+Package test is a generated protocol buffer package.
This package holds interesting messages.
@@ -18,7 +18,7 @@
OldReply
Communique
*/
-package my_test
+package test
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
@@ -69,6 +69,7 @@
*x = HatType(value)
return nil
}
+func (HatType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
// This enum represents days of the week.
type Days int32
@@ -106,6 +107,7 @@
*x = Days(value)
return nil
}
+func (Days) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type Request_Color int32
@@ -142,6 +144,7 @@
*x = Request_Color(value)
return nil
}
+func (Request_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
type Reply_Entry_Game int32
@@ -175,6 +178,7 @@
*x = Reply_Entry_Game(value)
return nil
}
+func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0, 0} }
// This is a message that might be sent somewhere.
type Request struct {
@@ -197,9 +201,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Request) Reset() { *m = Request{} }
-func (m *Request) String() string { return proto.CompactTextString(m) }
-func (*Request) ProtoMessage() {}
+func (m *Request) Reset() { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage() {}
+func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Request) Unmarshal(b []byte) error {
return xxx_messageInfo_Request.Unmarshal(m, b)
}
@@ -292,9 +297,10 @@
XXX_sizecache int32 `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) Reset() { *m = Request_SomeGroup{} }
+func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }
+func (*Request_SomeGroup) ProtoMessage() {}
+func (*Request_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
func (m *Request_SomeGroup) Unmarshal(b []byte) error {
return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b)
}
@@ -329,9 +335,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Reply) Reset() { *m = Reply{} }
-func (m *Reply) String() string { return proto.CompactTextString(m) }
-func (*Reply) ProtoMessage() {}
+func (m *Reply) Reset() { *m = Reply{} }
+func (m *Reply) String() string { return proto.CompactTextString(m) }
+func (*Reply) ProtoMessage() {}
+func (*Reply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
var extRange_Reply = []proto.ExtensionRange{
{100, 536870911},
@@ -381,9 +388,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
-func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
-func (*Reply_Entry) ProtoMessage() {}
+func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
+func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
+func (*Reply_Entry) ProtoMessage() {}
+func (*Reply_Entry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} }
func (m *Reply_Entry) Unmarshal(b []byte) error {
return xxx_messageInfo_Reply_Entry.Unmarshal(m, b)
}
@@ -433,9 +441,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *OtherBase) Reset() { *m = OtherBase{} }
-func (m *OtherBase) String() string { return proto.CompactTextString(m) }
-func (*OtherBase) ProtoMessage() {}
+func (m *OtherBase) Reset() { *m = OtherBase{} }
+func (m *OtherBase) String() string { return proto.CompactTextString(m) }
+func (*OtherBase) ProtoMessage() {}
+func (*OtherBase) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
var extRange_OtherBase = []proto.ExtensionRange{
{100, 536870911},
@@ -475,9 +484,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
-func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
-func (*ReplyExtensions) ProtoMessage() {}
+func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
+func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*ReplyExtensions) ProtoMessage() {}
+func (*ReplyExtensions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *ReplyExtensions) Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyExtensions.Unmarshal(m, b)
}
@@ -530,9 +540,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} }
-func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
-func (*OtherReplyExtensions) ProtoMessage() {}
+func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} }
+func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*OtherReplyExtensions) ProtoMessage() {}
+func (*OtherReplyExtensions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *OtherReplyExtensions) Unmarshal(b []byte) error {
return xxx_messageInfo_OtherReplyExtensions.Unmarshal(m, b)
}
@@ -565,9 +576,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *OldReply) Reset() { *m = OldReply{} }
-func (m *OldReply) String() string { return proto.CompactTextString(m) }
-func (*OldReply) ProtoMessage() {}
+func (m *OldReply) Reset() { *m = OldReply{} }
+func (m *OldReply) String() string { return proto.CompactTextString(m) }
+func (*OldReply) ProtoMessage() {}
+func (*OldReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *OldReply) MarshalJSON() ([]byte, error) {
return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
@@ -625,9 +637,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Communique) Reset() { *m = Communique{} }
-func (m *Communique) String() string { return proto.CompactTextString(m) }
-func (*Communique) ProtoMessage() {}
+func (m *Communique) Reset() { *m = Communique{} }
+func (m *Communique) String() string { return proto.CompactTextString(m) }
+func (*Communique) ProtoMessage() {}
+func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *Communique) Unmarshal(b []byte) error {
return xxx_messageInfo_Communique.Unmarshal(m, b)
}
@@ -975,9 +988,10 @@
XXX_sizecache int32 `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) Reset() { *m = Communique_SomeGroup{} }
+func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }
+func (*Communique_SomeGroup) ProtoMessage() {}
+func (*Communique_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} }
func (m *Communique_SomeGroup) Unmarshal(b []byte) error {
return xxx_messageInfo_Communique_SomeGroup.Unmarshal(m, b)
}
@@ -1009,9 +1023,10 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Communique_Delta) Reset() { *m = Communique_Delta{} }
-func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
-func (*Communique_Delta) ProtoMessage() {}
+func (m *Communique_Delta) Reset() { *m = Communique_Delta{} }
+func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
+func (*Communique_Delta) ProtoMessage() {}
+func (*Communique_Delta) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 1} }
func (m *Communique_Delta) Unmarshal(b []byte) error {
return xxx_messageInfo_Communique_Delta.Unmarshal(m, b)
}
@@ -1072,3 +1087,74 @@
proto.RegisterExtension(E_Tag)
proto.RegisterExtension(E_Donut)
}
+
+func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 1035 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdb, 0x6e, 0xdb, 0x46,
+ 0x13, 0xd6, 0x92, 0xa2, 0x0e, 0x23, 0xc5, 0xe6, 0xbf, 0x30, 0x6c, 0x42, 0x3f, 0x12, 0xb3, 0x6a,
+ 0x5d, 0xb0, 0x46, 0x23, 0x23, 0x6a, 0x81, 0x06, 0x2a, 0x1a, 0xc4, 0x3a, 0xd8, 0x32, 0x62, 0x49,
+ 0xc0, 0xda, 0xbe, 0x68, 0x6e, 0x88, 0xb5, 0xb8, 0xa6, 0x58, 0x6b, 0x49, 0x85, 0x5c, 0x16, 0xe5,
+ 0x9d, 0x9f, 0xa2, 0x7d, 0x8d, 0xde, 0xf7, 0x85, 0xfa, 0x16, 0x2e, 0x76, 0xa9, 0x4a, 0xb2, 0x15,
+ 0xf4, 0x86, 0xe0, 0xcc, 0x7c, 0xf3, 0x71, 0xe7,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f7, 0x1f, 0xdf, 0xf9, 0x81, 0x98, 0xa5, 0xb7, 0xad, 0x69, 0xc4, 0x4f, 0xfc,
+ 0x68, 0x4e, 0x43, 0xff, 0x44, 0x5d, 0x8e, 0xb7, 0xe9, 0x5d, 0xfe, 0x32, 0x7d, 0xed, 0xb3, 0xf0,
+ 0xb5, 0x1f, 0xa9, 0x5b, 0x55, 0xee, 0xc3, 0xc9, 0xf2, 0x9a, 0xfd, 0x51, 0x3e, 0xfe, 0x09, 0x00,
+ 0x00, 0xff, 0xff, 0x0d, 0xa4, 0x7d, 0x7c, 0x75, 0x07, 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/my_test/test.pb.go.golden b/protoc-gen-go/testdata/my_test/test.pb.go.golden
deleted file mode 100644
index 4afe896..0000000
--- a/protoc-gen-go/testdata/my_test/test.pb.go.golden
+++ /dev/null
@@ -1,1074 +0,0 @@
-// 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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Request) Reset() { *m = Request{} }
-func (m *Request) String() string { return proto.CompactTextString(m) }
-func (*Request) ProtoMessage() {}
-func (m *Request) Unmarshal(b []byte) error {
- return xxx_messageInfo_Request.Unmarshal(m, b)
-}
-func (m *Request) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Request.Marshal(b, m, deterministic)
-}
-func (dst *Request) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Request.Merge(dst, src)
-}
-func (m *Request) XXX_Size() int {
- return xxx_messageInfo_Request.Size(m)
-}
-func (m *Request) XXX_DiscardUnknown() {
- xxx_messageInfo_Request.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Request proto.InternalMessageInfo
-
-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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `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) Unmarshal(b []byte) error {
- return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b)
-}
-func (m *Request_SomeGroup) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Request_SomeGroup.Marshal(b, m, deterministic)
-}
-func (dst *Request_SomeGroup) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Request_SomeGroup.Merge(dst, src)
-}
-func (m *Request_SomeGroup) XXX_Size() int {
- return xxx_messageInfo_Request_SomeGroup.Size(m)
-}
-func (m *Request_SomeGroup) XXX_DiscardUnknown() {
- xxx_messageInfo_Request_SomeGroup.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Request_SomeGroup proto.InternalMessageInfo
-
-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"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- proto.XXX_InternalExtensions `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `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) Unmarshal(b []byte) error {
- return xxx_messageInfo_Reply.Unmarshal(m, b)
-}
-func (m *Reply) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Reply.Marshal(b, m, deterministic)
-}
-func (dst *Reply) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Reply.Merge(dst, src)
-}
-func (m *Reply) XXX_Size() int {
- return xxx_messageInfo_Reply.Size(m)
-}
-func (m *Reply) XXX_DiscardUnknown() {
- xxx_messageInfo_Reply.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Reply proto.InternalMessageInfo
-
-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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
-func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
-func (*Reply_Entry) ProtoMessage() {}
-func (m *Reply_Entry) Unmarshal(b []byte) error {
- return xxx_messageInfo_Reply_Entry.Unmarshal(m, b)
-}
-func (m *Reply_Entry) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Reply_Entry.Marshal(b, m, deterministic)
-}
-func (dst *Reply_Entry) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Reply_Entry.Merge(dst, src)
-}
-func (m *Reply_Entry) XXX_Size() int {
- return xxx_messageInfo_Reply_Entry.Size(m)
-}
-func (m *Reply_Entry) XXX_DiscardUnknown() {
- xxx_messageInfo_Reply_Entry.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Reply_Entry proto.InternalMessageInfo
-
-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"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- proto.XXX_InternalExtensions `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `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) Unmarshal(b []byte) error {
- return xxx_messageInfo_OtherBase.Unmarshal(m, b)
-}
-func (m *OtherBase) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_OtherBase.Marshal(b, m, deterministic)
-}
-func (dst *OtherBase) XXX_Merge(src proto.Message) {
- xxx_messageInfo_OtherBase.Merge(dst, src)
-}
-func (m *OtherBase) XXX_Size() int {
- return xxx_messageInfo_OtherBase.Size(m)
-}
-func (m *OtherBase) XXX_DiscardUnknown() {
- xxx_messageInfo_OtherBase.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_OtherBase proto.InternalMessageInfo
-
-func (m *OtherBase) GetName() string {
- if m != nil && m.Name != nil {
- return *m.Name
- }
- return ""
-}
-
-type ReplyExtensions struct {
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
-func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
-func (*ReplyExtensions) ProtoMessage() {}
-func (m *ReplyExtensions) Unmarshal(b []byte) error {
- return xxx_messageInfo_ReplyExtensions.Unmarshal(m, b)
-}
-func (m *ReplyExtensions) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_ReplyExtensions.Marshal(b, m, deterministic)
-}
-func (dst *ReplyExtensions) XXX_Merge(src proto.Message) {
- xxx_messageInfo_ReplyExtensions.Merge(dst, src)
-}
-func (m *ReplyExtensions) XXX_Size() int {
- return xxx_messageInfo_ReplyExtensions.Size(m)
-}
-func (m *ReplyExtensions) XXX_DiscardUnknown() {
- xxx_messageInfo_ReplyExtensions.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ReplyExtensions proto.InternalMessageInfo
-
-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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} }
-func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
-func (*OtherReplyExtensions) ProtoMessage() {}
-func (m *OtherReplyExtensions) Unmarshal(b []byte) error {
- return xxx_messageInfo_OtherReplyExtensions.Unmarshal(m, b)
-}
-func (m *OtherReplyExtensions) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_OtherReplyExtensions.Marshal(b, m, deterministic)
-}
-func (dst *OtherReplyExtensions) XXX_Merge(src proto.Message) {
- xxx_messageInfo_OtherReplyExtensions.Merge(dst, src)
-}
-func (m *OtherReplyExtensions) XXX_Size() int {
- return xxx_messageInfo_OtherReplyExtensions.Size(m)
-}
-func (m *OtherReplyExtensions) XXX_DiscardUnknown() {
- xxx_messageInfo_OtherReplyExtensions.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_OtherReplyExtensions proto.InternalMessageInfo
-
-func (m *OtherReplyExtensions) GetKey() int32 {
- if m != nil && m.Key != nil {
- return *m.Key
- }
- return 0
-}
-
-type OldReply struct {
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *OldReply) Reset() { *m = OldReply{} }
-func (m *OldReply) String() string { return proto.CompactTextString(m) }
-func (*OldReply) ProtoMessage() {}
-
-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.Unmarshaler
-var _ proto.Unmarshaler = (*OldReply)(nil)
-
-var extRange_OldReply = []proto.ExtensionRange{
- {100, 2147483646},
-}
-
-func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {
- return extRange_OldReply
-}
-func (m *OldReply) Unmarshal(b []byte) error {
- return xxx_messageInfo_OldReply.Unmarshal(m, b)
-}
-func (m *OldReply) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_OldReply.Marshal(b, m, deterministic)
-}
-func (dst *OldReply) XXX_Merge(src proto.Message) {
- xxx_messageInfo_OldReply.Merge(dst, src)
-}
-func (m *OldReply) XXX_Size() int {
- return xxx_messageInfo_OldReply.Size(m)
-}
-func (m *OldReply) XXX_DiscardUnknown() {
- xxx_messageInfo_OldReply.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_OldReply proto.InternalMessageInfo
-
-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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Communique) Reset() { *m = Communique{} }
-func (m *Communique) String() string { return proto.CompactTextString(m) }
-func (*Communique) ProtoMessage() {}
-func (m *Communique) Unmarshal(b []byte) error {
- return xxx_messageInfo_Communique.Unmarshal(m, b)
-}
-func (m *Communique) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Communique.Marshal(b, m, deterministic)
-}
-func (dst *Communique) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Communique.Merge(dst, src)
-}
-func (m *Communique) XXX_Size() int {
- return xxx_messageInfo_Communique.Size(m)
-}
-func (m *Communique) XXX_DiscardUnknown() {
- xxx_messageInfo_Communique.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Communique proto.InternalMessageInfo
-
-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_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `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) Unmarshal(b []byte) error {
- return xxx_messageInfo_Communique_SomeGroup.Unmarshal(m, b)
-}
-func (m *Communique_SomeGroup) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Communique_SomeGroup.Marshal(b, m, deterministic)
-}
-func (dst *Communique_SomeGroup) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Communique_SomeGroup.Merge(dst, src)
-}
-func (m *Communique_SomeGroup) XXX_Size() int {
- return xxx_messageInfo_Communique_SomeGroup.Size(m)
-}
-func (m *Communique_SomeGroup) XXX_DiscardUnknown() {
- xxx_messageInfo_Communique_SomeGroup.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Communique_SomeGroup proto.InternalMessageInfo
-
-func (m *Communique_SomeGroup) GetMember() string {
- if m != nil && m.Member != nil {
- return *m.Member
- }
- return ""
-}
-
-type Communique_Delta struct {
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Communique_Delta) Reset() { *m = Communique_Delta{} }
-func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
-func (*Communique_Delta) ProtoMessage() {}
-func (m *Communique_Delta) Unmarshal(b []byte) error {
- return xxx_messageInfo_Communique_Delta.Unmarshal(m, b)
-}
-func (m *Communique_Delta) Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Communique_Delta.Marshal(b, m, deterministic)
-}
-func (dst *Communique_Delta) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Communique_Delta.Merge(dst, src)
-}
-func (m *Communique_Delta) XXX_Size() int {
- return xxx_messageInfo_Communique_Delta.Size(m)
-}
-func (m *Communique_Delta) XXX_DiscardUnknown() {
- xxx_messageInfo_Communique_Delta.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Communique_Delta proto.InternalMessageInfo
-
-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.RegisterMapType((map[int64]*Reply)(nil), "my.test.Request.MsgMappingEntry")
- proto.RegisterMapType((map[int32]string)(nil), "my.test.Request.NameMappingEntry")
- 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)
-}
diff --git a/protoc-gen-go/testdata/my_test/test.proto b/protoc-gen-go/testdata/my_test/test.proto
index 8e70946..4f133dc 100644
--- a/protoc-gen-go/testdata/my_test/test.proto
+++ b/protoc-gen-go/testdata/my_test/test.proto
@@ -34,6 +34,8 @@
// This package holds interesting messages.
package my.test; // dotted package name
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/my_test;test";
+
//import "imp.proto";
import "multi/multi1.proto"; // unused import
diff --git a/protoc-gen-go/testdata/proto3/proto3.pb.go b/protoc-gen-go/testdata/proto3/proto3.pb.go
new file mode 100644
index 0000000..f268d7b
--- /dev/null
+++ b/protoc-gen-go/testdata/proto3/proto3.pb.go
@@ -0,0 +1,200 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: proto3/proto3.proto
+
+/*
+Package proto3 is a generated protocol buffer package.
+
+It is generated from these files:
+ proto3/proto3.proto
+
+It has these top-level messages:
+ Request
+ Book
+*/
+package proto3
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// 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 Request_Flavour int32
+
+const (
+ Request_SWEET Request_Flavour = 0
+ Request_SOUR Request_Flavour = 1
+ Request_UMAMI Request_Flavour = 2
+ Request_GOPHERLICIOUS Request_Flavour = 3
+)
+
+var Request_Flavour_name = map[int32]string{
+ 0: "SWEET",
+ 1: "SOUR",
+ 2: "UMAMI",
+ 3: "GOPHERLICIOUS",
+}
+var Request_Flavour_value = map[string]int32{
+ "SWEET": 0,
+ "SOUR": 1,
+ "UMAMI": 2,
+ "GOPHERLICIOUS": 3,
+}
+
+func (x Request_Flavour) String() string {
+ return proto.EnumName(Request_Flavour_name, int32(x))
+}
+func (Request_Flavour) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+
+type Request struct {
+ Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+ Key []int64 `protobuf:"varint,2,rep,packed,name=key" json:"key,omitempty"`
+ Taste Request_Flavour `protobuf:"varint,3,opt,name=taste,enum=proto3.Request_Flavour" json:"taste,omitempty"`
+ Book *Book `protobuf:"bytes,4,opt,name=book" json:"book,omitempty"`
+ Unpacked []int64 `protobuf:"varint,5,rep,name=unpacked" json:"unpacked,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Request) Reset() { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage() {}
+func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *Request) Unmarshal(b []byte) error {
+ return xxx_messageInfo_Request.Unmarshal(m, b)
+}
+func (m *Request) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Request.Marshal(b, m, deterministic)
+}
+func (dst *Request) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Request.Merge(dst, src)
+}
+func (m *Request) XXX_Size() int {
+ return xxx_messageInfo_Request.Size(m)
+}
+func (m *Request) XXX_DiscardUnknown() {
+ xxx_messageInfo_Request.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Request proto.InternalMessageInfo
+
+func (m *Request) GetName() string {
+ if m != nil {
+ return m.Name
+ }
+ return ""
+}
+
+func (m *Request) GetKey() []int64 {
+ if m != nil {
+ return m.Key
+ }
+ return nil
+}
+
+func (m *Request) GetTaste() Request_Flavour {
+ if m != nil {
+ return m.Taste
+ }
+ return Request_SWEET
+}
+
+func (m *Request) GetBook() *Book {
+ if m != nil {
+ return m.Book
+ }
+ return nil
+}
+
+func (m *Request) GetUnpacked() []int64 {
+ if m != nil {
+ return m.Unpacked
+ }
+ return nil
+}
+
+type Book struct {
+ Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"`
+ RawData []byte `protobuf:"bytes,2,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Book) Reset() { *m = Book{} }
+func (m *Book) String() string { return proto.CompactTextString(m) }
+func (*Book) ProtoMessage() {}
+func (*Book) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *Book) Unmarshal(b []byte) error {
+ return xxx_messageInfo_Book.Unmarshal(m, b)
+}
+func (m *Book) Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Book.Marshal(b, m, deterministic)
+}
+func (dst *Book) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Book.Merge(dst, src)
+}
+func (m *Book) XXX_Size() int {
+ return xxx_messageInfo_Book.Size(m)
+}
+func (m *Book) XXX_DiscardUnknown() {
+ xxx_messageInfo_Book.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Book proto.InternalMessageInfo
+
+func (m *Book) GetTitle() string {
+ if m != nil {
+ return m.Title
+ }
+ return ""
+}
+
+func (m *Book) GetRawData() []byte {
+ if m != nil {
+ return m.RawData
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterType((*Request)(nil), "proto3.Request")
+ proto.RegisterType((*Book)(nil), "proto3.Book")
+ proto.RegisterEnum("proto3.Request_Flavour", Request_Flavour_name, Request_Flavour_value)
+}
+
+func init() { proto.RegisterFile("proto3/proto3.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+ // 306 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xcf, 0x4e, 0xf2, 0x40,
+ 0x14, 0xc5, 0x99, 0xfe, 0xf9, 0x80, 0xfb, 0xa1, 0x19, 0xaf, 0x26, 0x8e, 0x1b, 0x33, 0x61, 0xd5,
+ 0x0d, 0x25, 0xc1, 0x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0x1c, 0x4f, 0x27, 0xd4, 0x6d, 0x9f, 0x83, 0x57, 0x64,
+ 0xe1, 0x11, 0xf8, 0x66, 0x61, 0x96, 0xbb, 0xdf, 0xd9, 0x05, 0x4f, 0xa0, 0x91, 0xc9, 0xed, 0xdb,
+ 0x5c, 0x1a, 0xc9, 0x1c, 0x4e, 0x82, 0x96, 0xa8, 0x67, 0x72, 0x7b, 0x2b, 0x8d, 0xec, 0x5f, 0xbe,
+ 0x5e, 0xc4, 0x0b, 0xf3, 0x91, 0x47, 0xe1, 0x4c, 0xaf, 0xba, 0xb1, 0x5e, 0xca, 0x34, 0xb6, 0x1d,
+ 0x46, 0xf9, 0xbb, 0x15, 0xb3, 0x4e, 0xac, 0xd2, 0x4e, 0xac, 0xbb, 0x46, 0x6d, 0x4c, 0xc1, 0xa8,
+ 0x3a, 0x8e, 0xaa, 0x76, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xec, 0x71, 0xee, 0xdb, 0x7b, 0x01,
+ 0x00, 0x00,
+}
diff --git a/protoc-gen-go/testdata/proto3.proto b/protoc-gen-go/testdata/proto3/proto3.proto
similarity index 95%
rename from protoc-gen-go/testdata/proto3.proto
rename to protoc-gen-go/testdata/proto3/proto3.proto
index 869b9af..79954e4 100644
--- a/protoc-gen-go/testdata/proto3.proto
+++ b/protoc-gen-go/testdata/proto3/proto3.proto
@@ -33,6 +33,8 @@
package proto3;
+option go_package = "github.com/golang/protobuf/protoc-gen-go/testdata/proto3";
+
message Request {
enum Flavour {
SWEET = 0;