Skip to content

Commit

Permalink
🧹 Minor tidy-up changes and tool upgrades (#19)
Browse files Browse the repository at this point in the history
A bunch of miscellaneous stuff prior to doing some real work:
* An check-uptodate change to ignore staged changes
* Update all hermit-managed binaries changes from that
* Resync protos, and regenerate dependent files

This merges the following commits:
* proto: Regenerate/sync protos
* hermit: Upgrade hermit-managed binaries
* build: Ignore staged changes on up-to-date check

     Makefile                                      |   2 +-
     bin/{.go-1.16.6.pkg => .go-1.19.pkg}          |   0
     ...t-1.41.1.pkg => .golangci-lint-1.48.0.pkg} |   0
     ...er-0.173.2.pkg => .goreleaser-0.184.0.pkg} |   0
     ...mports-0.1.5.pkg => .gosimports-0.2.2.pkg} |   0
     ...{.protoc-3.19.4.pkg => .protoc-3.20.1.pkg} |   0
     ...o-1.27.1.pkg => .protoc-gen-go-1.28.1.pkg} |   0
     ...otosync-0.2.1.pkg => .protosync-0.5.2.pkg} |   0
     bin/go                                        |   2 +-
     bin/gofmt                                     |   2 +-
     bin/golangci-lint                             |   2 +-
     bin/goreleaser                                |   2 +-
     bin/gosimports                                |   2 +-
     bin/protoc                                    |   2 +-
     bin/protoc-gen-go                             |   2 +-
     bin/protosync                                 |   2 +-
     httprule/httprule.go                          |  22 +++++++++---------
     httprule/internal/echo.pb.go                  |   4 ++--
     httprule/internal/test.pb.go                  |   4 ++--
     proto/google/protobuf/descriptor.proto        |  21 +++++++++++++++--
     registry/testdata/regtest.pb                  | Bin 9425 -> 9578 bytes
     registry/types_test.go                        |   6 ++---
     22 files changed, 46 insertions(+), 29 deletions(-)

Pull-Request: #19
  • Loading branch information
camh- committed Aug 18, 2022
2 parents c717e81 + c4c798c commit 1f0ea05
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/go
2 changes: 1 addition & 1 deletion bin/gofmt
2 changes: 1 addition & 1 deletion bin/golangci-lint
2 changes: 1 addition & 1 deletion bin/goreleaser
2 changes: 1 addition & 1 deletion bin/gosimports
2 changes: 1 addition & 1 deletion bin/protoc
2 changes: 1 addition & 1 deletion bin/protoc-gen-go
2 changes: 1 addition & 1 deletion bin/protosync
22 changes: 11 additions & 11 deletions httprule/httprule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions httprule/internal/echo.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions httprule/internal/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions proto/google/protobuf/descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Binary file modified registry/testdata/regtest.pb
Binary file not shown.
6 changes: 3 additions & 3 deletions registry/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1f0ea05

Please sign in to comment.