diff --git a/Makefile b/Makefile index 57f60a2..3da68ea 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ cover: test ## Show test coverage in your browser check-uptodate: proto go mod tidy - test -z "$$(git status --porcelain)" || { git diff; false; } + test -z "$$(git status --porcelain | grep '^[ ?]')" || { git diff; false; } CHECK_COVERAGE = awk -F '[ \t%]+' '/^total:/ {print; if ($$3 < $(COVERAGE)) exit 1}' FAIL_COVERAGE = { echo '$(COLOUR_RED)FAIL - Coverage below $(COVERAGE)%$(COLOUR_NORMAL)'; exit 1; } diff --git a/bin/.go-1.16.6.pkg b/bin/.go-1.19.pkg similarity index 100% rename from bin/.go-1.16.6.pkg rename to bin/.go-1.19.pkg diff --git a/bin/.golangci-lint-1.41.1.pkg b/bin/.golangci-lint-1.48.0.pkg similarity index 100% rename from bin/.golangci-lint-1.41.1.pkg rename to bin/.golangci-lint-1.48.0.pkg diff --git a/bin/.goreleaser-0.173.2.pkg b/bin/.goreleaser-0.184.0.pkg similarity index 100% rename from bin/.goreleaser-0.173.2.pkg rename to bin/.goreleaser-0.184.0.pkg diff --git a/bin/.gosimports-0.1.5.pkg b/bin/.gosimports-0.2.2.pkg similarity index 100% rename from bin/.gosimports-0.1.5.pkg rename to bin/.gosimports-0.2.2.pkg diff --git a/bin/.protoc-3.19.4.pkg b/bin/.protoc-3.20.1.pkg similarity index 100% rename from bin/.protoc-3.19.4.pkg rename to bin/.protoc-3.20.1.pkg diff --git a/bin/.protoc-gen-go-1.27.1.pkg b/bin/.protoc-gen-go-1.28.1.pkg similarity index 100% rename from bin/.protoc-gen-go-1.27.1.pkg rename to bin/.protoc-gen-go-1.28.1.pkg diff --git a/bin/.protosync-0.2.1.pkg b/bin/.protosync-0.5.2.pkg similarity index 100% rename from bin/.protosync-0.2.1.pkg rename to bin/.protosync-0.5.2.pkg diff --git a/bin/go b/bin/go index cbda71d..b7b0a77 120000 --- a/bin/go +++ b/bin/go @@ -1 +1 @@ -.go-1.16.6.pkg \ No newline at end of file +.go-1.19.pkg \ No newline at end of file diff --git a/bin/gofmt b/bin/gofmt index cbda71d..b7b0a77 120000 --- a/bin/gofmt +++ b/bin/gofmt @@ -1 +1 @@ -.go-1.16.6.pkg \ No newline at end of file +.go-1.19.pkg \ No newline at end of file diff --git a/bin/golangci-lint b/bin/golangci-lint index 8958d33..070e021 120000 --- a/bin/golangci-lint +++ b/bin/golangci-lint @@ -1 +1 @@ -.golangci-lint-1.41.1.pkg \ No newline at end of file +.golangci-lint-1.48.0.pkg \ No newline at end of file diff --git a/bin/goreleaser b/bin/goreleaser index db2edba..0edfc4b 120000 --- a/bin/goreleaser +++ b/bin/goreleaser @@ -1 +1 @@ -.goreleaser-0.173.2.pkg \ No newline at end of file +.goreleaser-0.184.0.pkg \ No newline at end of file diff --git a/bin/gosimports b/bin/gosimports index f85588e..3105886 120000 --- a/bin/gosimports +++ b/bin/gosimports @@ -1 +1 @@ -.gosimports-0.1.5.pkg \ No newline at end of file +.gosimports-0.2.2.pkg \ No newline at end of file diff --git a/bin/protoc b/bin/protoc index 775c89b..917dd2a 120000 --- a/bin/protoc +++ b/bin/protoc @@ -1 +1 @@ -.protoc-3.19.4.pkg \ No newline at end of file +.protoc-3.20.1.pkg \ No newline at end of file diff --git a/bin/protoc-gen-go b/bin/protoc-gen-go index a81f60a..1d8f14e 120000 --- a/bin/protoc-gen-go +++ b/bin/protoc-gen-go @@ -1 +1 @@ -.protoc-gen-go-1.27.1.pkg \ No newline at end of file +.protoc-gen-go-1.28.1.pkg \ No newline at end of file diff --git a/bin/protosync b/bin/protosync index 7f0818f..07f7cfe 120000 --- a/bin/protosync +++ b/bin/protosync @@ -1 +1 @@ -.protosync-0.2.1.pkg \ No newline at end of file +.protosync-0.5.2.pkg \ No newline at end of file diff --git a/httprule/httprule.go b/httprule/httprule.go index 4f5ac37..ce06cb2 100644 --- a/httprule/httprule.go +++ b/httprule/httprule.go @@ -4,11 +4,11 @@ // service have their HTTP mappings specified via `google.api.http` // method options, e.g.: // -// service HelloService { -// rpc Hello (HelloRequest) returns (HelloResponse) { -// option (google.api.http) = { post:"/api/hello" body:"*" }; -// }; -// }; +// service HelloService { +// rpc Hello (HelloRequest) returns (HelloResponse) { +// option (google.api.http) = { post:"/api/hello" body:"*" }; +// }; +// }; // // HttpRule proto: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto // HttpRule codegen: https://pkg.go.dev/google.golang.org/genproto/googleapis/api/annotations @@ -351,11 +351,11 @@ func jsonBody(bodyField string, msg proto.Message, skip map[string]bool) (io.Rea // interpolate returns a path from a templated path and a proto message // whose values are substituted in the path template. For example: // -// templatePath: "/v1/messages/{message_id}" -// proto message definition: message M { string message_id = 1; } -// proto message value: { message_id: 123 } +// templatePath: "/v1/messages/{message_id}" +// proto message definition: message M { string message_id = 1; } +// proto message value: { message_id: 123 } // -// => result path: "/v1/messages/123" +// => result path: "/v1/messages/123" // // Referenced message fields must have primitive types; they cannot not // repeated or message types. See: @@ -403,8 +403,8 @@ func interpolate(templ string, msg proto.Message, skipKeys map[string]bool) (str // urlRawQuery converts a proto message into url.Values. // -// {"a": "A", "b": {"nested": "🐣"}, "SLICE": [1, 2]}} -// => ?a=A&b.nested=🐣&SLICE=1&SLICE=2 +// {"a": "A", "b": {"nested": "🐣"}, "SLICE": [1, 2]}} +// => ?a=A&b.nested=🐣&SLICE=1&SLICE=2 // // TODO: Investigate zero value encoding for optional and default types. func urlRawQuery(bodyRule string, m proto.Message, skip map[string]bool) (string, error) { diff --git a/httprule/internal/echo.pb.go b/httprule/internal/echo.pb.go index 0dde86f..6f3b75a 100644 --- a/httprule/internal/echo.pb.go +++ b/httprule/internal/echo.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc-gen-go v1.28.1 +// protoc v3.20.1 // source: echo.proto package internal diff --git a/httprule/internal/test.pb.go b/httprule/internal/test.pb.go index 6399f58..de334cc 100644 --- a/httprule/internal/test.pb.go +++ b/httprule/internal/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc-gen-go v1.28.1 +// protoc v3.20.1 // source: test.proto package internal diff --git a/proto/google/protobuf/descriptor.proto b/proto/google/protobuf/descriptor.proto index 5b4d06b..2e19d33 100644 --- a/proto/google/protobuf/descriptor.proto +++ b/proto/google/protobuf/descriptor.proto @@ -86,8 +86,13 @@ message FileDescriptorProto { optional SourceCodeInfo source_code_info = 9; // The syntax of the proto file. - // The supported values are "proto2" and "proto3". + // The supported values are "proto2", "proto3", and "editions". + // + // If `edition` is present, this value must be "editions". optional string syntax = 12; + + // The edition of the proto file, which is an opaque string. + optional string edition = 13; } // Describes a message type. @@ -911,8 +916,20 @@ message GeneratedCodeInfo { optional int32 begin = 3; // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past + // relates to the identified object. The end offset should be one past // the last relevant byte (so the length of the text = end - begin). optional int32 end = 4; + + // Represents the identified object's effect on the element in the original + // .proto file. + enum Semantic { + // There is no effect or the effect is indescribable. + NONE = 0; + // The element is set or otherwise mutated. + SET = 1; + // An alias to the element is returned. + ALIAS = 2; + } + optional Semantic semantic = 5; } } diff --git a/registry/testdata/regtest.pb b/registry/testdata/regtest.pb index 8e5042f..94b4577 100644 Binary files a/registry/testdata/regtest.pb and b/registry/testdata/regtest.pb differ diff --git a/registry/types_test.go b/registry/types_test.go index 57f1e0f..128de18 100644 --- a/registry/types_test.go +++ b/registry/types_test.go @@ -28,13 +28,13 @@ func TestAddDynamicTypes(t *testing.T) { // regtest.pb includes descriptor.proto, annotations.proto, http.proto and empty.proto // regtest: 3 messages, 0 enums, 4 extensions - // descriptor.proto: 27 messages, 6 enums, 0 extensions + // descriptor.proto: 27 messages, 7 enums, 0 extensions // annotations.proto: 0 messages, 0 enums, 1 extension // http.proto: 3 messages, 0 enums, 0 extensions // empty.proto: 1 message, 0 enums, 0 extensions - // total: 34 messages, 6 enums, 5 extensions + // total: 34 messages, 7 enums, 5 extensions require.Equal(t, 34, types.NumMessages()) - require.Equal(t, 6, types.NumEnums()) + require.Equal(t, 7, types.NumEnums()) require.Equal(t, 5, types.NumExtensions()) // descriptorpb.FileDescriptorSet should be dynamic as we have only loaded