Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Feb 22, 2024
1 parent c30ee59 commit 11df18e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ 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
- maintidx # covered by gocyclo
- maligned # readability trumps efficient struct packing
- 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $(BIN)/license-header: Makefile

$(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.56.2

$(BIN)/protoc-gen-connect-go: Makefile go.mod
@mkdir -p $(@D)
Expand Down
10 changes: 5 additions & 5 deletions validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestInterceptorUnary(t *testing.T) {
},
{
name: "underlying_error",
svc: func(_ context.Context, req *connect.Request[userv1.CreateUserRequest]) (*connect.Response[userv1.CreateUserResponse], error) {
svc: func(_ context.Context, _ *connect.Request[userv1.CreateUserRequest]) (*connect.Response[userv1.CreateUserResponse], error) {
return nil, connect.NewError(connect.CodeInternal, errors.New("oh no"))
},
req: &userv1.CreateUserRequest{
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestInterceptorUnary(t *testing.T) {
if test.wantCode > 0 {
require.Error(t, err)
var connectErr *connect.Error
require.True(t, errors.As(err, &connectErr))
require.ErrorAs(t, err, &connectErr)
assert.Equal(t, test.wantCode, connectErr.Code())
if test.wantPath != "" {
details := connectErr.Details()
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestInterceptorStreamingHandler(t *testing.T) {
if test.wantCode > 0 {
require.Error(t, err)
var connectErr *connect.Error
assert.True(t, errors.As(err, &connectErr))
require.ErrorAs(t, err, &connectErr)
assert.Equal(t, test.wantCode, connectErr.Code())
if test.wantPath != "" {
details := connectErr.Details()
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestInterceptorStreamingClient(t *testing.T) {
if test.wantCode > 0 {
require.Error(t, err)
var connectErr *connect.Error
assert.True(t, errors.As(err, &connectErr))
require.ErrorAs(t, err, &connectErr)
t.Log(connectErr)
assert.Equal(t, test.wantCode, connectErr.Code())
if test.wantPath != "" {
Expand All @@ -281,7 +281,7 @@ func TestInterceptorStreamingClient(t *testing.T) {
require.NoError(t, err)
got, receiveErr := stream.Receive()
if test.wantReceiveCode > 0 {
require.Equal(t, connect.CodeOf(receiveErr), test.wantReceiveCode)
require.Equal(t, test.wantReceiveCode, connect.CodeOf(receiveErr))
} else {
require.NoError(t, receiveErr)
require.NotZero(t, got.Sum)
Expand Down

0 comments on commit 11df18e

Please sign in to comment.