Skip to content

Commit

Permalink
Merge branch 'main' into ed/dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Nov 20, 2023
2 parents cbafb36 + 4562545 commit a74a335
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 84 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/add-to-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Add issues and PRs to project

on:
issues:
types:
- opened
- reopened
- transferred
pull_request_target:
types:
- opened
- reopened

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- name: Get GitHub app token
uses: actions/create-github-app-token@v1
id: app_token
with:
app-id: ${{ secrets.CONNECT_EXPORT_APP_ID }}
private-key: ${{ secrets.CONNECT_EXPORT_APP_KEY }}
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/connectrpc/projects/1
github-token: ${{ steps.app_token.outputs.token }}
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ linters:
- golint # deprecated by Go team
- gomnd # some unnamed constants are okay
- ifshort # deprecated by author
- inamedparam # convention is not followed
- interfacer # deprecated by author
- ireturn # "accept interfaces, return structs" isn't ironclad
- lll # don't want hard limits for line length
Expand All @@ -52,6 +53,7 @@ linters:
- nlreturn # generous whitespace violates house style
- nonamedreturns # named returns are fine; it's *bare* returns that are bad
- nosnakecase # deprecated in https://github.com/golangci/golangci-lint/pull/3065
- protogetter # too many false positives
- scopelint # deprecated by author
- structcheck # abandoned
- testpackage # internal tests are fine
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ $(BIN)/protoc-gen-connect-go:

$(BIN)/buf: Makefile
@mkdir -p $(@D)
go install github.com/bufbuild/buf/cmd/buf@v1.26.1
go install github.com/bufbuild/buf/cmd/buf@v1.27.2

$(BIN)/license-header: Makefile
@mkdir -p $(@D)
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.26.1
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.27.2

$(BIN)/golangci-lint: Makefile
@mkdir -p $(@D)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2

$(BIN)/protoc-gen-go: Makefile go.mod
@mkdir -p $(@D)
Expand Down
16 changes: 8 additions & 8 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func BenchmarkConnect(b *testing.B) {
)
if err != nil {
b.Error(err)
} else if response.Msg.Number != 42 {
b.Errorf("expected 42, got %d", response.Msg.Number)
} else if num := response.Msg.GetNumber(); num != 42 {
b.Errorf("expected 42, got %d", num)
}
}
})
Expand All @@ -121,8 +121,8 @@ func BenchmarkConnect(b *testing.B) {
response, err := stream.CloseAndReceive()
if err != nil {
b.Error(err)
} else if response.Msg.Sum != expect {
b.Errorf("expected %d, got %d", expect, response.Msg.Sum)
} else if got := response.Msg.GetSum(); got != expect {
b.Errorf("expected %d, got %d", expect, got)
}
}
})
Expand All @@ -142,8 +142,8 @@ func BenchmarkConnect(b *testing.B) {
}
number := int64(1)
for ; stream.Receive(); number++ {
if stream.Msg().Number != number {
b.Errorf("expected %d, got %d", number, stream.Msg().Number)
if got := stream.Msg().GetNumber(); got != number {
b.Errorf("expected %d, got %d", number, got)
}
}
if number != upTo+1 {
Expand All @@ -170,8 +170,8 @@ func BenchmarkConnect(b *testing.B) {
if err != nil {
b.Error(err)
}
if msg.Sum != number*(number+1)/2 {
b.Errorf("expected %d, got %d", number*(number+1)/2, msg.Sum)
if got, expected := msg.GetSum(), number*(number+1)/2; got != expected {
b.Errorf("expected %d, got %d", expected, got)
}
}
if err := stream.CloseRequest(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions client_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestClientPeer(t *testing.T) {
text := strings.Repeat(".", 256)
r, err := client.Ping(ctx, connect.NewRequest(&pingv1.PingRequest{Text: text}))
assert.Nil(t, err)
assert.Equal(t, r.Msg.Text, text)
assert.Equal(t, r.Msg.GetText(), text)
})
t.Run("client_stream", func(t *testing.T) {
clientStream := client.Sum(ctx)
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestSpecSchema(t *testing.T) {
text := strings.Repeat(".", 256)
r, err := client.Ping(ctx, connect.NewRequest(&pingv1.PingRequest{Text: text}))
assert.Nil(t, err)
assert.Equal(t, r.Msg.Text, text)
assert.Equal(t, r.Msg.GetText(), text)
})
t.Run("bidi_stream", func(t *testing.T) {
t.Parallel()
Expand Down
6 changes: 3 additions & 3 deletions client_get_fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func TestClientUnaryGetFallback(t *testing.T) {
"/connect.ping.v1.PingService/Ping",
func(ctx context.Context, r *Request[pingv1.PingRequest]) (*Response[pingv1.PingResponse], error) {
return NewResponse(&pingv1.PingResponse{
Number: r.Msg.Number,
Text: r.Msg.Text,
Number: r.Msg.GetNumber(),
Text: r.Msg.GetText(),
}), nil
},
WithIdempotency(IdempotencyNoSideEffects),
Expand All @@ -55,5 +55,5 @@ func TestClientUnaryGetFallback(t *testing.T) {
text := strings.Repeat(".", 256)
r, err := client.CallUnary(ctx, NewRequest(&pingv1.PingRequest{Text: text}))
assert.Nil(t, err)
assert.Equal(t, r.Msg.Text, text)
assert.Equal(t, r.Msg.GetText(), text)
}
Loading

0 comments on commit a74a335

Please sign in to comment.