protobuf-go/cmd/protoc-gen-go/testdata/import_public/a.proto
Damien Neil 84395510fc cmd/protoc-gen-go: add additional import public test case
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>
2019-01-07 23:17:17 +00:00

20 lines
670 B
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;
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public";
import public "import_public/sub/a.proto"; // Different Go package.
import public "import_public/sub2/a.proto"; // Different Go package.
import public "import_public/b.proto"; // Same Go package.
message Public {
optional goproto.protoc.import_public.sub.M m = 1;
optional goproto.protoc.import_public.sub.E e = 2;
optional Local local = 3;
}