diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a451423..6a30415 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: defaults: run: working-directory: ${{ env.GOPATH }}/src/github.com/lyft/protoc-gen-star - name: protoc version 3.17.0 + name: protoc version 3.19.5 steps: - uses: actions/checkout@v2 with: @@ -25,7 +25,7 @@ jobs: with: go-version: '1.17' - run: mkdir -p $GOPATH/bin - - run: wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.0/protoc-3.17.0-linux-x86_64.zip" -O /tmp/protoc.zip + - run: wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.19.5/protoc-3.19.5-linux-x86_64.zip" -O /tmp/protoc.zip - run: unzip /tmp/protoc.zip -d /tmp - run: sudo mv /tmp/bin/protoc /usr/local/bin/protoc - run: sudo mv /tmp/include/google /usr/local/include/google diff --git a/Makefile b/Makefile index 66b484c..259db25 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ # the name of this package PKG := $(shell go list .) PROTOC_VER := $(shell protoc --version | cut -d' ' -f2) +PGG_VER := $(shell protoc-gen-go --version | cut -d' ' -f2 | cut -c 2- ) .PHONY: bootstrap bootstrap: testdata # set up the project for development .PHONY: quick quick: testdata # runs all tests without the race detector or coverage -ifeq ($(PROTOC_VER), 3.17.0) +ifeq ($(PROTOC_VER), 3.19.5) go test $(PKGS) --tags=proto3_presence else go test $(PKGS) @@ -15,7 +16,7 @@ endif .PHONY: tests tests: testdata # runs all tests against the package with race detection and coverage percentage -ifeq ($(PROTOC_VER), 3.17.0) +ifeq ($(PROTOC_VER), 3.19.5) go test -race -cover ./... --tags=proto3_presence else go test -race -cover ./... @@ -23,7 +24,7 @@ endif .PHONY: cover cover: testdata # runs all tests against the package, generating a coverage report and opening it in the browser -ifeq ($(PROTOC_VER), 3.17.0) +ifeq ($(PROTOC_VER), 3.19.5) go test -race -covermode=atomic -coverprofile=cover.out ./... --tags=proto3_presence || true else go test -race -covermode=atomic -coverprofile=cover.out ./... || true @@ -40,7 +41,7 @@ docs: # starts a doc server and opens a browser window to this package testdata: testdata-graph testdata-go testdata/generated testdata/fdset.bin # generate all testdata .PHONY: testdata-graph -testdata-graph: bin/protoc-gen-debug # parses the proto file sets in testdata/graph and renders binary CodeGeneratorRequest +testdata-graph: # parses the proto file sets in testdata/graph and renders binary CodeGeneratorRequest set -e; for subdir in `find ./testdata/graph -mindepth 1 -maxdepth 1 -type d`; do \ protoc -I ./testdata/graph \ --plugin=protoc-gen-debug=./bin/protoc-gen-debug \ @@ -48,8 +49,7 @@ testdata-graph: bin/protoc-gen-debug # parses the proto file sets in testdata/gr `find $$subdir -name "*.proto"`; \ done -testdata/generated: protoc-gen-go bin/protoc-gen-example - go install google.golang.org/protobuf/cmd/protoc-gen-go +testdata/generated: bin/protoc-gen-example rm -rf ./testdata/generated && mkdir -p ./testdata/generated # generate the official go code, must be one directory at a time set -e; for subdir in `find ./testdata/protos -mindepth 1 -type d`; do \ @@ -74,19 +74,22 @@ testdata/fdset.bin: testdata/protos/**/*.proto .PHONY: testdata-go -testdata-go: protoc-gen-go bin/protoc-gen-debug # generate go-specific testdata +testdata-go: # generate go-specific testdata cd lang/go && $(MAKE) \ testdata-names \ testdata-packages \ testdata-outputs -ifeq ($(PROTOC_VER), 3.17.0) +ifeq ($(PROTOC_VER), 3.19.5) cd lang/go && $(MAKE) \ testdata-presence endif .PHONY: protoc-gen-go protoc-gen-go: +ifeq ($(PGG_VER), 1.26.0) +else go install google.golang.org/protobuf/cmd/protoc-gen-go +endif bin/protoc-gen-example: # creates the demo protoc plugin for demonstrating uses of PG* go build -o ./bin/protoc-gen-example ./testdata/protoc-gen-example diff --git a/field.go b/field.go index 11bb522..6213126 100644 --- a/field.go +++ b/field.go @@ -22,7 +22,7 @@ type Field interface { // InRealOneOf returns true if the field is in a OneOf of the parent Message. // This will return false for synthetic oneofs, and will only include 'real' oneofs. - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md InRealOneOf() bool // OneOf returns the OneOf that this field is a part of. Nil is returned if @@ -33,7 +33,7 @@ type Field interface { Type() FieldType // HasPresence returns true for all fields that have explicit presence as defined by: - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md HasPresence() bool // HasOptionalKeyword returns whether the field is labeled as optional. diff --git a/init_option.go b/init_option.go index 5c92c2f..3b72b18 100644 --- a/init_option.go +++ b/init_option.go @@ -49,7 +49,7 @@ func BiDirectional() InitOption { } // SupportedFeatures allows defining protoc features to enable / disable. -// See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/implementing_proto3_presence.md#signaling-that-your-code-generator-supports-proto3-optional +// See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/implementing_proto3_presence.md#signaling-that-your-code-generator-supports-proto3-optional func SupportedFeatures(feat *uint64) InitOption { return func(g *Generator) { g.persister.SetSupportedFeatures(feat) diff --git a/lang/go/testdata/names/keyword/keyword.proto b/lang/go/testdata/names/keyword/keyword.proto index 34c6923..bd98e12 100644 --- a/lang/go/testdata/names/keyword/keyword.proto +++ b/lang/go/testdata/names/keyword/keyword.proto @@ -1,6 +1,6 @@ syntax="proto3"; package names.keyword; -option go_package = "example.com/package"; +option go_package = "example.com/package;package"; message Package {} diff --git a/lang/go/testdata/names/path_dash/path_dash.proto b/lang/go/testdata/names/path_dash/path_dash.proto index e7cd848..4159283 100644 --- a/lang/go/testdata/names/path_dash/path_dash.proto +++ b/lang/go/testdata/names/path_dash/path_dash.proto @@ -1,5 +1,5 @@ syntax="proto3"; package names.path_dash; -option go_package="example.com/path-dash"; +option go_package="example.com/path-dash;path_dash"; message PathDash {} \ No newline at end of file diff --git a/message.go b/message.go index b3b4735..7850f97 100644 --- a/message.go +++ b/message.go @@ -30,7 +30,7 @@ type Message interface { OneOfFields() []Field // SyntheticOneOfFields returns only the fields contained within synthetic OneOf blocks. - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md SyntheticOneOfFields() []Field // OneOfs returns the OneOfs contained within this Message. @@ -38,7 +38,7 @@ type Message interface { // RealOneOfs returns the OneOfs contained within this Message. // This excludes synthetic OneOfs. - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md RealOneOfs() []OneOf // Extensions returns all of the Extensions applied to this Message. diff --git a/oneof.go b/oneof.go index 70d14a4..1b81cdf 100644 --- a/oneof.go +++ b/oneof.go @@ -20,7 +20,7 @@ type OneOf interface { Fields() []Field // IsSynthetic returns true if this is a proto3 synthetic oneof. - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md IsSynthetic() bool setMessage(m Message) diff --git a/proto.go b/proto.go index 977cccb..75da122 100644 --- a/proto.go +++ b/proto.go @@ -16,7 +16,7 @@ const ( // Proto3 syntax permits the use of "optional" field presence. Non optional fields default to the zero // value of that particular type if not defined. // Most of the field types in the generated go structs are value types. - // See: https://github.com/protocolbuffers/protobuf/blob/v3.17.0/docs/field_presence.md#presence-in-proto3-apis + // See: https://github.com/protocolbuffers/protobuf/blob/v3.19.5/docs/field_presence.md#presence-in-proto3-apis Proto3 Syntax = "proto3" )