Skip to content

Tags: foxygoat/jig

Tags

v0.0.43

Toggle v0.0.43's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
🐞 Fix goreleaser flags (#56)

Fix goreleaser to use `--clean` instead of `-rm-dist`. This should un-break the
build on the master branch which continuously releases.

Link: https://goreleaser.com/deprecations/#-rm-dist
Pull-request: #56

v0.0.42

Toggle v0.0.42's commit message
☝️ all: Upgrade tooling and Go dependencies (#55)

Upgrade all hermitised tooling with `hermit upgrade` and Go dependencies with
`go get -u ./...` and `go mod tidy`.

Regenerate proto bindings in .pb.go files with `make proto`.

Manually fix new linter errors, all static check deprecation errors.

This merges the following commits:
* hermit: Upgrade [1/4]
* go: Upgrade dependencies [2/4]
* pb: Regenerate proto binding [3/4]
* go: Fix new linter errors [4/4]

     bin/{.go-1.18.pkg => .go-1.23.6.pkg}          |   0
     ...{.gofumpt-0.2.0.pkg => .gofumpt-0.7.0.pkg} |   0
     ...t-1.45.2.pkg => .golangci-lint-1.63.4.pkg} |   0
     ...leaser-1.1.0.pkg => .goreleaser-2.6.1.pkg} |   0
     bin/{.make-4.3.pkg => .make-4.4.pkg}          |   0
     ...{.protoc-3.19.1.pkg => .protoc-3.20.3.pkg} |   0
     ...o-1.27.1.pkg => .protoc-gen-go-1.36.4.pkg} |   0
     ....1.0.pkg => .protoc-gen-go-grpc-1.3.0.pkg} |   0
     bin/go                                        |   2 +-
     bin/gofmt                                     |   2 +-
     bin/gofumpt                                   |   2 +-
     bin/golangci-lint                             |   2 +-
     bin/goreleaser                                |   2 +-
     bin/make                                      |   2 +-
     bin/protoc                                    |   2 +-
     bin/protoc-gen-go                             |   2 +-
     bin/protoc-gen-go-grpc                        |   2 +-
     go.mod                                        |  38 ++--
     go.sum                                        | 103 +++++----
     internal/cmd/client/main.go                   |   6 +-
     main_test.go                                  |   6 +-
     pb/exemplar/exemplar.pb.go                    | 202 ++++++------------
     pb/exemplar/exemplar_grpc.pb.go               |  19 +-
     pb/greet/greeter.pb.go                        |  98 +++------
     pb/greet/greeter_grpc.pb.go                   |  21 +-
     pb/httpgreet/httpgreet.pb.go                  |  90 +++-----
     pb/httpgreet/httpgreet_grpc.pb.go             |  27 ++-
     reflection/service.go                         |   6 +-
     serve/httprule/handler_test.go                |  11 +-
     serve/httprule/httprule.go                    |   4 +-
     serve/server_test.go                          |   9 +-
     31 files changed, 292 insertions(+), 366 deletions(-)

Pull-request: #55

v0.0.41

Toggle v0.0.41's commit message
♻️ Remove internal/client package (#54)

Refactor server_test.go to be independent from internal/client package and
less brittle by avoiding sting comparison in favour of comparing map values
for certain keys for headers and trailers. In a follow up commit we will
upgrade protoc-gen-go and libraries which made these tests fail, so we are
fixing them first and independently.

Remove client package once server_test.go doesn't depend on it anymore. Roughly
include it in cmd/client/main.go, as private methods on config/cli struct
type.

This merges the following commits:
* test: Refactor server_test.go
* internal: Remove client package

     internal/client/client.go   | 187 --------------------
     internal/cmd/client/main.go | 166 +++++++++++++++++-
     serve/server_test.go        | 328 ++++++++++++++++++++++++------------
     3 files changed, 378 insertions(+), 303 deletions(-)

Pull-request: #54

v0.0.40

Toggle v0.0.40's commit message
🐞 housekeeping: Complete previous fixups (#53)

Complete previous fixups removing deprecated calls to `httprule.NewServer` and
avoiding data races by calling `server.NewUnstartedTestServer`.

This merges the following commits:
* test: Fix data race
* httprule: Use NewHandler, not deprecated NewServer

     main_test.go         | 8 ++++++--
     serve/server_test.go | 6 +++---
     2 files changed, 9 insertions(+), 5 deletions(-)

Pull-request: #53

v0.0.39

Toggle v0.0.39's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
🐞 test: Fix data race (#52)

Fix data race in go tests detected by Go's race detector. When investigating a
spurious CI failure in the tests, we found that `NewTestServer()` in combination
with test server method `SetHTTPHandler` causes a race as reported by the
detector:

	WARNING: DATA RACE
	Read at 0x00c000354220 by goroutine 10:
	  foxygo.at/jig/serve.(*Server).Serve()
	      /Users/julia/Development/jig/serve/server.go:102 +0x208
	  foxygo.at/jig/serve.(*TestServer).Start.func1()
	      /Users/julia/Development/jig/serve/server.go:269 +0x50

	Previous write at 0x00c000354220 by goroutine 7:
	  foxygo.at/jig/serve.(*Server).SetHTTPHandler()
	      /Users/julia/Development/jig/serve/server.go:96 +0x1ec
	  foxygo.at/jig/serve/httprule.TestHTTP()
	      /Users/julia/Development/jig/serve/httprule/handler_test.go:29 +0x1dc

Fix by using `NewUnstartedTestServer` and explicitly and synchronously calling
`Start` method after calling `SetHTTPHandler`.

Add the `-race` flag in Makefile to Go test execution.

Pull-request: #52

v0.0.38

Toggle v0.0.38's commit message
🐛 bones: Emit proto map as object not array of pairs (#51)

Emit a proto `map<key, val>` as a JSON object instead of an array of
key/value pairs, with keys converted to strings. The array is the
internal proto representation of a map but the protojson format
specifies an object as the representation of a map. The bones exemplars
are not parsable by protojson, producing the error:

    proto: syntax error (line X:XX): unexpected token  [.

It is possible that the array of pairs representation was parsable in
the past, but it is not true today and there is no support for schema
evolution for JSON at the same level as the proto wire format.

A test has been added to ensure that the exemplars can be parsed
server-side and the values are received on the client as expected.

The `exemplar.proto` has been updated to use a non-string key type to
show the string conversion necessary. The `pb` files generated from that
were updated with:

    make proto

The bones golden files were updated for the new output format and the
changes to `exemplar.proto` with:

    make golden

Thanks to Sutina Wipawiwat (@wsutina) for reporting this.

This merges the following commits:
* exemplar: Change basic map exemplar to use int32 key [1/2]
* exemplar: Update generated protos and golden files [2/2]
* exemplar: Add end-to-end tests for serving exemplars [1/3]
* bones: Emit proto map as object not array of pairs [2/3]
* bones: Update bones golden files for new map format [3/3]

     bones/exemplar.go                             |  54 +++++++++++++--
     .../exemplar.Exemplar.Sample.js               |  26 +++----
     .../exemplar.Exemplar.Sample.jsonnet          |  26 +++----
     .../exemplar.Exemplar.Sample.js               |  26 +++----
     .../exemplar.Exemplar.Sample.jsonnet          |  26 +++----
     go.mod                                        |   1 +
     go.sum                                        |   1 +
     main_test.go                                  |  65 ++++++++++++++++++
     pb/exemplar/exemplar.pb                       | Bin 9117 -> 9117 bytes
     pb/exemplar/exemplar.pb.go                    |   6 +-
     proto/exemplar/exemplar.proto                 |   2 +-
     11 files changed, 159 insertions(+), 74 deletions(-)

Issue: #50
Pull-request: #51

v0.0.37

Toggle v0.0.37's commit message
✨ httprule: Add optional "default" handler (#49)

Add an optional "default" handler to `httprule.Handler` that is called if
the request does not match any of the gRPC methods. The default is still to
return a 404 Not Found status if no "default" handler is supplied.

This allows chaining handlers so that other non-gRPC paths can be handled
by other handlers, with precedence given to gRPC paths.

Refactor `httprule.Server` to `httprule.Handler` and add function
options to a new `NewHandler()` constructor. There were already a couple
of optional arguments to `NewServer()` and the "default" handler would
have been another. So switch to function options, leaving the existing
`NewServer()` as is and aliasing `Server` to the new `Handler`.

This merges the following commits:
* httprule: Rename Server to Handler and implement function options
* httprule: Add optional "default" handler

     main.go                                       |  5 +-
     serve/httprule/{server.go => handler.go}      | 97 +++++++++++++++----
     .../{server_test.go => handler_test.go}       | 23 ++++-
     3 files changed, 105 insertions(+), 20 deletions(-)

Co-authored-by: Bob Lail <lail@squareup.com>
Pull-request: #49

v0.0.36

Toggle v0.0.36's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
⬆️ Update dependencies for latest genproto version (#47)

Update our dependencies to be compatible with the current latest release
of `google.golang.org/genproto` by running:

    go get google.golang.org/genproto
    go mod tidy

This has broken a couple of small things, which are fixed here:

* The generated var name for the embedded protobuf descriptors has
  changed, so when `google.golang.org/grpc` got updated due to the
  genproto update, `reflection/service.go` needed to be updated with
  the new name. This was changed in grpc/grpc-go#5799.
  The var name changed because its proto import changed as part of that
  PR, and the var name is based on the import name.

* The error message for when `SendHeader` is called multiple times on a
  stream has changed which broke a test that was testing the error type
  and string. This was changed upstream in grpc/grpc-go#5292.

Link: grpc/grpc-go#5799
Link: grpc/grpc-go#5292
Pull-Request: #47

v0.0.35

Toggle v0.0.35's commit message
🦴 Update bones: don't reprint previous messages (#44)

Update bones output, don't re-print messages already processed. This is an
extension in response to a real world example where the bones files ended
up being several hundred mega bytes large.

While at it, offer an even more minimal output, setting up files with
appropriate file names and fully qualified request and response
parameter types without any further zero values.

This merges the following commits:
* Fix Makefile
* Run go mod tidy
* Add log messages to bones
* Update bones output, don't re-print messages already processed
* Add minimal message exemplar

     Makefile                                      |  28 ++-
     bones/exemplar.go                             | 107 ++++++---
     bones/generate.go                             |  15 +-
     bones/generate_test.go                        |  18 +-
     .../exemplar.Exemplar.Sample.js               |  25 +-
     .../exemplar.Exemplar.Sample.jsonnet          |  25 +-
     .../exemplar.Exemplar.WellKnown.js            | 110 +++++++++
     .../exemplar.Exemplar.WellKnown.jsonnet       | 108 +++++++++
     .../exemplar.Exemplar.Sample.js               |  14 ++
     .../exemplar.Exemplar.Sample.jsonnet          |  12 +
     .../exemplar.Exemplar.WellKnown.js            |  14 ++
     .../exemplar.Exemplar.WellKnown.jsonnet       |  12 +
     .../exemplar.Exemplar.WellKnown.js            | 214 ------------------
     .../exemplar.Exemplar.WellKnown.jsonnet       | 212 -----------------
     .../exemplar.Exemplar.Sample.js               |  25 +-
     .../exemplar.Exemplar.Sample.jsonnet          |  25 +-
     .../exemplar.Exemplar.WellKnown.js            | 110 +++++++++
     .../exemplar.Exemplar.WellKnown.jsonnet       | 108 +++++++++
     .../exemplar.Exemplar.Sample.js               |  14 ++
     .../exemplar.Exemplar.Sample.jsonnet          |  12 +
     .../exemplar.Exemplar.WellKnown.js            |  14 ++
     .../exemplar.Exemplar.WellKnown.jsonnet       |  12 +
     .../exemplar.Exemplar.WellKnown.js            | 214 ------------------
     .../exemplar.Exemplar.WellKnown.jsonnet       | 212 -----------------
     .../greet.Greeter.Hello.js                    |   4 +-
     .../greet.Greeter.Hello.jsonnet               |   4 +-
     .../greet.Greeter.HelloBidiStream.js          |   4 +-
     .../greet.Greeter.HelloBidiStream.jsonnet     |   4 +-
     .../greet.Greeter.HelloClientStream.js        |   4 +-
     .../greet.Greeter.HelloClientStream.jsonnet   |   4 +-
     .../greet.Greeter.HelloServerStream.js        |   4 +-
     .../greet.Greeter.HelloServerStream.jsonnet   |   4 +-
     .../greet.Greeter.Hello.js                    |  14 ++
     .../greet.Greeter.Hello.jsonnet               |  12 +
     .../greet.Greeter.HelloBidiStream.js          |  16 ++
     .../greet.Greeter.HelloBidiStream.jsonnet     |  14 ++
     .../greet.Greeter.HelloClientStream.js        |  16 ++
     .../greet.Greeter.HelloClientStream.jsonnet   |  14 ++
     .../greet.Greeter.HelloServerStream.js        |  16 ++
     .../greet.Greeter.HelloServerStream.jsonnet   |  14 ++
     .../greet.Greeter.Hello.js                    |   4 +-
     .../greet.Greeter.Hello.jsonnet               |   4 +-
     .../greet.Greeter.HelloBidiStream.js          |   4 +-
     .../greet.Greeter.HelloBidiStream.jsonnet     |   4 +-
     .../greet.Greeter.HelloClientStream.js        |   4 +-
     .../greet.Greeter.HelloClientStream.jsonnet   |   4 +-
     .../greet.Greeter.HelloServerStream.js        |   4 +-
     .../greet.Greeter.HelloServerStream.jsonnet   |   4 +-
     .../greet.Greeter.Hello.js                    |  14 ++
     .../greet.Greeter.Hello.jsonnet               |  12 +
     .../greet.Greeter.HelloBidiStream.js          |  16 ++
     .../greet.Greeter.HelloBidiStream.jsonnet     |  14 ++
     .../greet.Greeter.HelloClientStream.js        |  16 ++
     .../greet.Greeter.HelloClientStream.jsonnet   |  14 ++
     .../greet.Greeter.HelloServerStream.js        |  16 ++
     .../greet.Greeter.HelloServerStream.jsonnet   |  14 ++
     go.mod                                        |   1 -
     go.sum                                        |   2 -
     log/log.go                                    |   2 +
     main.go                                       |  38 +++-
     main_test.go                                  |   5 +-
     serve/httprule/server_test.go                 |   5 +-
     serve/server_test.go                          |   3 +-
     63 files changed, 976 insertions(+), 1036 deletions(-)

Pull-Request: #44

v0.0.34

Toggle v0.0.34's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
📐 Add httpRuleTemplate to httpruleServer (#43)

Add httpRuleTemplate to httpruleServer, so that if no google.api.http
options are provided a default HTTP/1.1 mapping can be interpolated, eg
with

    templ := []*annotations.HttpRule{{Pattern: &annotations.HttpRule_Post{Post: "/post/{pkg}.{service}/{method}"}, Body: "*"}}

Known interpolation values are `{pkg}`, `{service}` and `
{method}`, taken as the short names from the corresponding
descriptors.

In order to create tests, add a bare method httpgreet.proto without any
google.api.http annotation. Re run `make proto` and add all updated and
newly generated files.

We had a test failure when the new test was added. Using gRPCServer.Stop
(), rather than gRPCServer.GracefulStop() seems to have fixed faulty or
delayed cleanup.

Pull-Request: #43