Skip to content

Commit

Permalink
Bump to require Go v1.20, test with v1.22 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane authored Nov 6, 2024
1 parent 10e0a47 commit 1221bc4
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.19.x, 1.20.x, 1.21.x]
go-version: [1.20.x, 1.21.x, 1.22.x]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Test
Expand All @@ -32,5 +32,5 @@ jobs:
# conflicting guidance, run only on the most recent supported version.
# For the same reason, only check generated code on the most recent
# supported version.
if: matrix.go-version == '1.21.x'
if: matrix.go-version == '1.22.x'
run: make checkgenerate && make lint
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 LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 The Connect Authors
Copyright 2023-2024 The Connect Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
export PATH := $(BIN):$(PATH)
export GOBIN := $(abspath $(BIN))
COPYRIGHT_YEARS := 2023
COPYRIGHT_YEARS := 2023-2024
LICENSE_IGNORE := --ignore testdata/

.PHONY: help
Expand Down Expand Up @@ -70,15 +70,15 @@ checkgenerate:

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

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

$(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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module connectrpc.com/validate

go 1.19
go 1.20

require (
buf.build/gen/go/bufbuild/protovalidate-testing/protocolbuffers/go v1.31.0-20230824200732-8bc04916caea.1
Expand Down
2 changes: 1 addition & 1 deletion internal/gen/example/calculator/v1/calculator.pb.go

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

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

2 changes: 1 addition & 1 deletion internal/gen/example/user/v1/user.pb.go

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

2 changes: 1 addition & 1 deletion internal/gen/example/user/v1/userv1connect/user.connect.go

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

2 changes: 1 addition & 1 deletion internal/proto/example/calculator/v1/calculator.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The Connect Authors
// Copyright 2023-2024 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/example/user/v1/user.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The Connect Authors
// Copyright 2023-2024 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion validate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The Connect Authors
// Copyright 2023-2024 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
12 changes: 6 additions & 6 deletions validate_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The Connect Authors
// Copyright 2023-2024 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down 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 1221bc4

Please sign in to comment.