Skip to content

Commit 77e6780

Browse files
authored
chore: update linter and Go
1 parent b49c602 commit 77e6780

File tree

8 files changed

+29
-42
lines changed

8 files changed

+29
-42
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
GO_VERSION: stable
16-
GOLANGCI_LINT_VERSION: v1.57.2
16+
GOLANGCI_LINT_VERSION: v1.62.0
1717
CGO_ENABLED: 0
1818

1919
steps:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
# https://goreleaser.com/ci/actions/
2929
- name: Run GoReleaser
30-
uses: goreleaser/goreleaser-action@v5
30+
uses: goreleaser/goreleaser-action@v6
3131
with:
3232
version: latest
3333
args: release --clean

.golangci.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,16 @@ linters-settings:
5353
linters:
5454
enable-all: true
5555
disable:
56-
- scopelint # deprecated
57-
- interfacer # deprecated
58-
- maligned # deprecated
59-
- golint # deprecated
60-
- exhaustivestruct # deprecated
61-
- scopelint # deprecated
62-
- varcheck # deprecated
63-
- structcheck # deprecated
64-
- nosnakecase # deprecated
65-
- deadcode # deprecated
66-
- ifshort # deprecated
56+
- exportloopref # deprecated
6757
- sqlclosecheck # not relevant (SQL)
6858
- rowserrcheck # not relevant (SQL)
6959
- cyclop # duplicate of gocyclo
7060
- lll
7161
- dupl
7262
- wsl
7363
- nlreturn
74-
- gomnd
75-
- goerr113
64+
- mnd
65+
- err113
7666
- wrapcheck
7767
- exhaustive
7868
- exhaustruct
@@ -99,3 +89,6 @@ issues:
9989
linters:
10090
- funlen
10191
- noctx
92+
93+
output:
94+
show-stats: true

.goreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: 2
12
project_name: mocktail
23

34
builds:
@@ -50,7 +51,7 @@ brews:
5051
commit_author:
5152
name: traefiker
5253
email: 30906710+traefiker@users.noreply.github.com
53-
folder: Formula
54+
directory: Formula
5455
homepage: https://github.com/traefik/mocktail
5556
description: |
5657
Naive code generator that creates mock implementation using testify.mock.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/traefik/mocktail
22

3-
go 1.21
3+
go 1.22.0
44

55
require (
66
github.com/ettle/strcase v0.2.0
7-
github.com/stretchr/testify v1.8.1
7+
github.com/stretchr/testify v1.9.0
88
)
99

1010
require (

go.sum

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
21
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
32
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
43
github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q=
54
github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A=
65
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
76
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
9-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
10-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
11-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
12-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
13-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
14-
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
7+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
8+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
159
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1610
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
17-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1811
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1912
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

mocktail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func walk(root, moduleName string) (map[string]PackageDesc, error) {
153153
return fmt.Errorf("type %q in %q is not an interface", lookup.Type(), fp)
154154
}
155155

156-
for i := 0; i < interfaceType.NumMethods(); i++ {
156+
for i := range interfaceType.NumMethods() {
157157
method := interfaceType.Method(i)
158158

159159
interfaceDesc.Methods = append(interfaceDesc.Methods, method)
@@ -197,7 +197,7 @@ func getTupleImports(tuples ...*types.Tuple) []string {
197197
var imports []string
198198

199199
for _, tuple := range tuples {
200-
for i := 0; i < tuple.Len(); i++ {
200+
for i := range tuple.Len() {
201201
imports = append(imports, getTypeImports(tuple.At(i).Type())...)
202202
}
203203
}

syrup.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (s Syrup) mockedMethod(writer io.Writer) error {
121121
params := s.Signature.Params()
122122

123123
var argNames []string
124-
for i := 0; i < params.Len(); i++ {
124+
for i := range params.Len() {
125125
param := params.At(i)
126126

127127
if param.Type().String() == contextType {
@@ -147,7 +147,7 @@ func (s Syrup) mockedMethod(writer io.Writer) error {
147147
w.Print("(")
148148
}
149149

150-
for i := 0; i < results.Len(); i++ {
150+
for i := range results.Len() {
151151
w.Print(s.getTypeName(results.At(i).Type(), false))
152152
if i+1 < results.Len() {
153153
w.Print(", ")
@@ -168,7 +168,7 @@ func (s Syrup) mockedMethod(writer io.Writer) error {
168168

169169
s.writeReturnsFnCaller(w, argNames, params, results)
170170

171-
for i := 0; i < results.Len(); i++ {
171+
for i := range results.Len() {
172172
if i == 0 {
173173
w.Println()
174174
}
@@ -186,7 +186,7 @@ func (s Syrup) mockedMethod(writer io.Writer) error {
186186
}
187187
}
188188

189-
for i := 0; i < results.Len(); i++ {
189+
for i := range results.Len() {
190190
if i == 0 {
191191
w.Println()
192192
w.Print("\treturn ")
@@ -230,7 +230,7 @@ func (s Syrup) methodOn(writer io.Writer) error {
230230
params := s.Signature.Params()
231231

232232
var argNames []string
233-
for i := 0; i < params.Len(); i++ {
233+
for i := range params.Len() {
234234
param := params.At(i)
235235

236236
if param.Type().String() == contextType {
@@ -276,7 +276,7 @@ func (s Syrup) methodOnRaw(writer io.Writer) error {
276276
params := s.Signature.Params()
277277

278278
var argNames []string
279-
for i := 0; i < params.Len(); i++ {
279+
for i := range params.Len() {
280280
param := params.At(i)
281281

282282
if param.Type().String() == contextType {
@@ -374,7 +374,7 @@ func (s Syrup) typedReturns(writer io.Writer) error {
374374
w.Printf("func (_c *%s%sCall) TypedReturns(", structBaseName, s.Method.Name())
375375

376376
var returnNames string
377-
for i := 0; i < results.Len(); i++ {
377+
for i := range results.Len() {
378378
rName := string(rune(int('a') + i))
379379

380380
w.Printf("%s %s", rName, s.getTypeName(results.At(i).Type(), false))
@@ -408,7 +408,7 @@ func (s Syrup) typedRun(writer io.Writer) error {
408408

409409
var pos int
410410
var paramNames []string
411-
for i := 0; i < params.Len(); i++ {
411+
for i := range params.Len() {
412412
param := params.At(i)
413413
pType := param.Type()
414414

@@ -479,7 +479,7 @@ func (s Syrup) callMethodsOn(writer io.Writer, methods []*types.Func) error {
479479
params := sign.Params()
480480

481481
var argNames []string
482-
for i := 0; i < params.Len(); i++ {
482+
for i := range params.Len() {
483483
param := params.At(i)
484484

485485
if param.Type().String() == contextType {
@@ -525,7 +525,7 @@ func (s Syrup) callMethodOnRaw(writer io.Writer, methods []*types.Func) error {
525525
params := sign.Params()
526526

527527
var argNames []string
528-
for i := 0; i < params.Len(); i++ {
528+
for i := range params.Len() {
529529
param := params.At(i)
530530

531531
if param.Type().String() == contextType {
@@ -603,7 +603,7 @@ func (s Syrup) getTypeName(t types.Type, last bool) string {
603603

604604
func (s Syrup) getTupleTypes(t *types.Tuple) []string {
605605
var tupleTypes []string
606-
for i := 0; i < t.Len(); i++ {
606+
for i := range t.Len() {
607607
param := t.At(i)
608608

609609
tupleTypes = append(tupleTypes, s.getTypeName(param.Type(), false))
@@ -645,7 +645,7 @@ func (s Syrup) getChanTypeName(t *types.Chan) string {
645645

646646
func (s Syrup) createFuncSignature(params, results *types.Tuple) string {
647647
fnSign := "func("
648-
for i := 0; i < params.Len(); i++ {
648+
for i := range params.Len() {
649649
param := params.At(i)
650650
if param.Type().String() == contextType {
651651
continue
@@ -661,7 +661,7 @@ func (s Syrup) createFuncSignature(params, results *types.Tuple) string {
661661

662662
if results != nil {
663663
fnSign += "("
664-
for i := 0; i < results.Len(); i++ {
664+
for i := range results.Len() {
665665
rType := results.At(i).Type()
666666
fnSign += s.getTypeName(rType, false)
667667
if i+1 < results.Len() {

0 commit comments

Comments
 (0)