Skip to content

Commit ec05ae4

Browse files
authored
Update CI and deps (#88)
1 parent 0f5ebfc commit ec05ae4

29 files changed

+95
-83
lines changed

.github/workflows/bench.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
GO111MODULE: "on"
2222
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
2323
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
24-
GO_VERSION: 1.18.x
24+
GO_VERSION: 1.19.x
2525
jobs:
2626
bench:
2727
runs-on: ubuntu-latest

.github/workflows/cloc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
- name: Count Lines Of Code
2525
id: loc
2626
run: |
27-
curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "b17e76bede22af0206b4918d3b3c4e7357f2a21b57f8de9e7c9dc0eb56b676c0 sccdiff" | shasum -c
27+
curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.3/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
28+
sccdiff_hash=$(git hash-object ./sccdiff)
29+
[ "$sccdiff_hash" == "ae8a07b687bd3dba60861584efe724351aa7ff63" ] || (echo "::error::unexpected hash for sccdiff, possible tampering: $sccdiff_hash" && exit 1)
2830
OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
2931
echo "${OUTPUT}"
3032
OUTPUT="${OUTPUT//$'\n'/%0A}"

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
steps:
2222
- uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- uses: actions/checkout@v2
2626
- name: golangci-lint
27-
uses: golangci/golangci-lint-action@v3.1.0
27+
uses: golangci/golangci-lint-action@v3.2.0
2828
with:
2929
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
30-
version: v1.46.2
30+
version: v1.50.0
3131

3232
# Optional: working directory, useful for monorepos
3333
# working-directory: somedir

.github/workflows/gorelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
GO_VERSION: 1.18.x
12+
GO_VERSION: 1.19.x
1313
jobs:
1414
gorelease:
1515
runs-on: ubuntu-latest

.github/workflows/test-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
go-version: [1.18.x ]
14+
go-version: [1.19.x ]
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Install Go stable

.github/workflows/test-unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
test:
2222
strategy:
2323
matrix:
24-
go-version: [ 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x ]
24+
go-version: [ 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x ]
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Install Go stable

.golangci.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,20 @@ linters:
4141
- ireturn
4242
- exhaustruct
4343
- nonamedreturns
44+
- nosnakecase
45+
- structcheck
46+
- varcheck
47+
- deadcode
48+
- testableexamples
49+
- dupword
4450

4551
issues:
4652
exclude-use-default: false
4753
exclude-rules:
54+
- linters:
55+
- staticcheck
56+
path: ".go"
57+
text: "\"io/ioutil\" has been deprecated since Go 1.16" # Keeping backwards compatibility with go1.13.
4858
- linters:
4959
- gomnd
5060
- goconst
@@ -54,8 +64,11 @@ issues:
5464
- dupl
5565
- structcheck
5666
- unused
67+
- unparam
68+
- nosnakecase
5769
path: "_test.go"
5870
- linters:
59-
- staticcheck
60-
path: ".go"
61-
text: "package io/ioutil is deprecated"
71+
- errcheck # Error checking omitted for brevity.
72+
- gosec
73+
path: "example_"
74+

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#GOLANGCI_LINT_VERSION := "v1.46.2" # Optional configuration to pinpoint golangci-lint version.
1+
#GOLANGCI_LINT_VERSION := "v1.50.0" # Optional configuration to pinpoint golangci-lint version.
22

33
# The head of Makefile determines location of dev-go to include standard targets.
44
GO ?= go

_examples/advanced-generic/_testdata/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
"schema":{"type":"string","description":"Sample response header."}
319319
}
320320
},
321-
"content":{"text/csv":{"schema":{}}}
321+
"content":{"text/csv":{"schema":{"type":"string"}}}
322322
},
323323
"500":{
324324
"description":"Internal Server Error",

_examples/advanced-generic/router_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ package main
44

55
import (
66
"encoding/json"
7-
"io/ioutil"
87
"net/http"
98
"net/http/httptest"
9+
"os"
1010
"testing"
1111

1212
"github.com/stretchr/testify/assert"
@@ -28,10 +28,10 @@ func TestNewRouter(t *testing.T) {
2828
actualSchema, err := assertjson.MarshalIndentCompact(json.RawMessage(rw.Body.Bytes()), "", " ", 120)
2929
require.NoError(t, err)
3030

31-
expectedSchema, err := ioutil.ReadFile("_testdata/openapi.json")
31+
expectedSchema, err := os.ReadFile("_testdata/openapi.json")
3232
require.NoError(t, err)
3333

3434
if !assertjson.Equal(t, expectedSchema, rw.Body.Bytes(), string(actualSchema)) {
35-
require.NoError(t, ioutil.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
35+
require.NoError(t, os.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
3636
}
3737
}

_examples/advanced/_testdata/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
"schema":{"type":"string","description":"Sample response header."}
287287
}
288288
},
289-
"content":{"text/csv":{"schema":{}}}
289+
"content":{"text/csv":{"schema":{"type":"string"}}}
290290
},
291291
"500":{
292292
"description":"Internal Server Error",

_examples/advanced/router_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package main
22

33
import (
44
"encoding/json"
5-
"io/ioutil"
65
"net/http"
76
"net/http/httptest"
7+
"os"
88
"testing"
99

1010
"github.com/stretchr/testify/assert"
@@ -26,10 +26,10 @@ func TestNewRouter(t *testing.T) {
2626
actualSchema, err := assertjson.MarshalIndentCompact(json.RawMessage(rw.Body.Bytes()), "", " ", 120)
2727
require.NoError(t, err)
2828

29-
expectedSchema, err := ioutil.ReadFile("_testdata/openapi.json")
29+
expectedSchema, err := os.ReadFile("_testdata/openapi.json")
3030
require.NoError(t, err)
3131

3232
if !assertjson.Equal(t, expectedSchema, rw.Body.Bytes(), string(actualSchema)) {
33-
require.NoError(t, ioutil.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
33+
require.NoError(t, os.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
3434
}
3535
}

_examples/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ replace github.com/swaggest/rest => ../
66

77
require (
88
github.com/bool64/ctxd v1.1.2
9-
github.com/bool64/dev v0.2.18
9+
github.com/bool64/dev v0.2.22
1010
github.com/bool64/httpmock v0.1.6
1111
github.com/bool64/httptestbench v0.1.3
1212
github.com/go-chi/chi/v5 v5.0.7
1313
github.com/kelseyhightower/envconfig v1.4.0
1414
github.com/rs/cors v1.8.2
1515
github.com/stretchr/testify v1.8.0
1616
github.com/swaggest/assertjson v1.7.0
17-
github.com/swaggest/jsonschema-go v0.3.35
18-
github.com/swaggest/openapi-go v0.2.18
17+
github.com/swaggest/jsonschema-go v0.3.40
18+
github.com/swaggest/openapi-go v0.2.22
1919
github.com/swaggest/swgui v1.4.5
20-
github.com/swaggest/usecase v1.1.3
20+
github.com/swaggest/usecase v1.2.0
2121
github.com/valyala/fasthttp v1.35.0
2222
)
2323

_examples/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/bool64/ctxd v1.1.2 h1:6J05q1vTG0op2O0kP+LosCd9wJ0qJybcvdE+bPjUJZE=
55
github.com/bool64/ctxd v1.1.2/go.mod h1:5rwLykeZBJHK27q5sSfhfKig6076270V+3iiXbP+HFY=
66
github.com/bool64/dev v0.1.35/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
77
github.com/bool64/dev v0.1.41/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
8-
github.com/bool64/dev v0.2.18 h1:FPXZxR4+bgNgBKtORwCr7W/s46bY/LkKFwVy8f63cqI=
9-
github.com/bool64/dev v0.2.18/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
8+
github.com/bool64/dev v0.2.22 h1:YJFKBRKplkt+0Emq/5Xk1Z5QRmMNzc1UOJkR3rxJksA=
9+
github.com/bool64/dev v0.2.22/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
1010
github.com/bool64/httpmock v0.1.6 h1:v9+AmoSabaHuR7abjnhGwGxsaNljtFAYtluF0p4Q3ng=
1111
github.com/bool64/httpmock v0.1.6/go.mod h1:pQukYUfoG9gW4fRAv+xHuvA2BlRoauEXK/XG5mKD04I=
1212
github.com/bool64/httptestbench v0.1.3 h1:bPDM3YPtE3o2sqIwjhdTC55wiqwfHsqps2RGcWBesuo=
@@ -57,16 +57,16 @@ github.com/swaggest/assertjson v1.7.0 h1:SKw5Rn0LQs6UvmGrIdaKQbMR1R3ncXm5KNon+QJ
5757
github.com/swaggest/assertjson v1.7.0/go.mod h1:vxMJMehbSVJd+dDWFCKv3QRZKNTpy/ktZKTz9LOEDng=
5858
github.com/swaggest/form/v5 v5.0.1 h1:YQH0REX7iMKhtoVPWXREZgbt50VYXNCKK61psnD8Fgo=
5959
github.com/swaggest/form/v5 v5.0.1/go.mod h1:vdnaSTze7cxVKhWiCabrfm1YeLwWLpb9P941Gxv4FnA=
60-
github.com/swaggest/jsonschema-go v0.3.35 h1:LW5DC0WgR5YdQXyTRc5e8gLdKT0wkACg4aVJyaseU+4=
61-
github.com/swaggest/jsonschema-go v0.3.35/go.mod h1:JAF1nm+uIaMOXktuQepmkiRcgQ5yJk4Ccwx9HVt2cXw=
62-
github.com/swaggest/openapi-go v0.2.18 h1:9dTzNe91MoepI5PtHNUgby3R0ZNgTQte+pDh3X5XcDw=
63-
github.com/swaggest/openapi-go v0.2.18/go.mod h1:xUrd0cNiIfhkSIFwxmMmiw3FLegY/MQzSek3Byp4YjU=
60+
github.com/swaggest/jsonschema-go v0.3.40 h1:9EqQ9RvtdW69xfYODmyEKWOSZ12x5eiK+wGD2EVh/L4=
61+
github.com/swaggest/jsonschema-go v0.3.40/go.mod h1:ipIOmoFP64QyRUgyPyU/P9tayq2m2TlvUhyZHrhe3S4=
62+
github.com/swaggest/openapi-go v0.2.22 h1:uKZwAXo/LSNOSqkIUF81wS0fZujraRab79GYNc/79bc=
63+
github.com/swaggest/openapi-go v0.2.22/go.mod h1:kgzt+q28wgd4A3iRDY7xL7k0Q9JXxHlR9U/lFI1AQ7w=
6464
github.com/swaggest/refl v1.1.0 h1:a+9a75Kv6ciMozPjVbOfcVTEQe81t2R3emvaD9oGQGc=
6565
github.com/swaggest/refl v1.1.0/go.mod h1:g3Qa6ki0A/L2yxiuUpT+cuBURuRaltF5SDQpg1kMZSY=
6666
github.com/swaggest/swgui v1.4.5 h1:9kw3Lt+4qNdDwnRgpNSsx3s3BjoW/Inhbn7/38DX6Qk=
6767
github.com/swaggest/swgui v1.4.5/go.mod h1:qfAwdL49ikzxahZrLrPJYAruNuL1Nt6do8jtC9luAlI=
68-
github.com/swaggest/usecase v1.1.3 h1:SGnmV07jyDhdg+gqEAv/NNc8R18JQqJUs4wVq+LWa5g=
69-
github.com/swaggest/usecase v1.1.3/go.mod h1:gLSjsqHiDmHOIf081asqys7UUndFrTWrfNa2opxEt7k=
68+
github.com/swaggest/usecase v1.2.0 h1:cHVFqxIbHfyTXp02JmWXk+ZADaSa87UZP+b3qL5Nz90=
69+
github.com/swaggest/usecase v1.2.0/go.mod h1:oc5+QoAxG3Et5Gl9lRXgEOm00l4VN9gdVQSMIa5EeLY=
7070
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
7171
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
7272
github.com/valyala/fasthttp v1.35.0 h1:wwkR8mZn2NbigFsaw2Zj5r+xkmzjbrA/lyTmiSlal/Y=
@@ -84,14 +84,14 @@ github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcm
8484
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
8585
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
8686
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
87-
golang.org/x/net v0.0.0-20220630215102-69896b714898 h1:K7wO6V1IrczY9QOQ2WkVpw4JQSwCd52UsxVEirZUfiw=
87+
golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48 h1:N9Vc/rorQUDes6B9CNdIxAn5jODGj2wzfrei2x4wNj4=
8888
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
8989
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9090
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9191
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9292
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9393
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
94-
golang.org/x/sys v0.0.0-20220702020025-31831981b65f h1:xdsejrW/0Wf2diT5CPp3XmKUNbr7Xvw8kYilQ+6qjRY=
94+
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME=
9595
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
9696
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
9797
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

_examples/task-api/internal/infra/repository/task.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ func (tr *Task) Create(ctx context.Context, value task.Value) (task.Entity, erro
154154
}
155155

156156
// FinishExpired closes expired tasks.
157-
// nolint:unused // False positive.
157+
//
158+
// nolint:unused // False positive.
158159
func (tr *Task) FinishExpired(_ context.Context) error {
159160
tr.mu.Lock()
160161
defer tr.mu.Unlock()

chirouter/path_decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
// PathToURLValues is a decoder function for parameters in path.
11-
func PathToURLValues(r *http.Request) (url.Values, error) { // nolint:unparam // Matches request.DecoderFactory.SetDecoderFunc.
11+
func PathToURLValues(r *http.Request) (url.Values, error) { //nolint:unparam // Matches request.DecoderFactory.SetDecoderFunc.
1212
if routeCtx := chi.RouteContext(r.Context()); routeCtx != nil {
1313
params := make(url.Values, len(routeCtx.URLParams.Keys))
1414

error.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ type ErrWithCanonicalStatus interface {
3434
// Err creates HTTP status code and ErrResponse for error.
3535
//
3636
// You can use it with use case status code:
37-
// rest.Err(status.NotFound)
37+
//
38+
// rest.Err(status.NotFound)
3839
func Err(err error) (int, ErrResponse) {
3940
if err == nil {
4041
panic("nil error received")

go.mod

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/swaggest/rest
33
go 1.17
44

55
require (
6-
github.com/bool64/dev v0.2.18
6+
github.com/bool64/dev v0.2.22
77
github.com/bool64/httpmock v0.1.6
88
github.com/bool64/shared v0.1.5
99
github.com/cespare/xxhash/v2 v2.1.2
@@ -12,23 +12,20 @@ require (
1212
github.com/stretchr/testify v1.8.0
1313
github.com/swaggest/assertjson v1.7.0
1414
github.com/swaggest/form/v5 v5.0.1
15-
github.com/swaggest/jsonschema-go v0.3.35
16-
github.com/swaggest/openapi-go v0.2.18
15+
github.com/swaggest/jsonschema-go v0.3.40
16+
github.com/swaggest/openapi-go v0.2.22
1717
github.com/swaggest/refl v1.1.0
18-
github.com/swaggest/usecase v1.1.3
18+
github.com/swaggest/usecase v1.2.0
1919
)
2020

2121
require (
2222
github.com/davecgh/go-spew v1.1.1 // indirect
23-
github.com/fsnotify/fsnotify v1.4.9 // indirect
2423
github.com/iancoleman/orderedmap v0.2.0 // indirect
2524
github.com/pmezard/go-difflib v1.0.0 // indirect
2625
github.com/sergi/go-diff v1.2.0 // indirect
2726
github.com/yosuke-furukawa/json5 v0.1.2-0.20201207051438-cf7bb3f354ff // indirect
2827
github.com/yudai/gojsondiff v1.0.0 // indirect
2928
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
30-
golang.org/x/text v0.3.7 // indirect
31-
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
3229
gopkg.in/yaml.v2 v2.4.0 // indirect
3330
gopkg.in/yaml.v3 v3.0.1 // indirect
3431
)

0 commit comments

Comments
 (0)