mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-17 01:12:51 +00:00
84395510fc
New test case demonstrating an import public bug: a.proto publicly imports b.proto and c.proto b.proto publicly imports c.proto a.pb.go includes two copies of symbols in c.pb.go The problem is that the new implementation of public imports, which parses the generated code for the import to determine what symbols are present, doesn't distinguish between symbols defined in a file and symbols imported from a public import of some other file. This can then lead to duplicate definitions in cases like the above. Change-Id: Ia86e9f188d7bae8d9d4afbd2b5db9b64071425c3 Reviewed-on: https://go-review.googlesource.com/c/156347 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
51 lines
1.1 KiB
Protocol Buffer
51 lines
1.1 KiB
Protocol Buffer
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
syntax = "proto2";
|
|
|
|
package goproto.protoc.import_public.sub;
|
|
|
|
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub";
|
|
|
|
import "import_public/sub/b.proto";
|
|
import public "import_public/sub2/a.proto";
|
|
|
|
message M {
|
|
// Field using a type in the same Go package, but a different source file.
|
|
optional M2 m2 = 1;
|
|
optional string s = 4 [default="default"];
|
|
optional bytes b = 5 [default="default"];
|
|
optional double f = 6 [default=nan];
|
|
|
|
oneof oneof_field {
|
|
int32 oneof_int32 = 2;
|
|
int64 oneof_int64 = 3;
|
|
}
|
|
|
|
message Submessage {
|
|
enum Submessage_Subenum {
|
|
M_SUBMESSAGE_ZERO = 0;
|
|
}
|
|
|
|
oneof submessage_oneof_field {
|
|
int32 submessage_oneof_int32 = 1;
|
|
int64 submessage_oneof_int64 = 2;
|
|
}
|
|
}
|
|
|
|
enum Subenum {
|
|
M_ZERO = 0;
|
|
}
|
|
|
|
extensions 100 to max;
|
|
}
|
|
|
|
extend M {
|
|
optional string extension_field = 100;
|
|
}
|
|
|
|
enum E {
|
|
ZERO = 0;
|
|
}
|