Skip to content

Commit 0ad3399

Browse files
authored
Update CI for Go 1.25 (#106)
1 parent d34954c commit 0ad3399

File tree

5 files changed

+66
-53
lines changed

5 files changed

+66
-53
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
go: ["1.18.x", "1.22.x", "1.23.x"]
16+
go: ["1.18.x", "1.23.x", "1.25.x"]
1717
include:
18-
- go: 1.23.x
18+
- go: 1.25.x
1919
latest: true
2020

2121
steps:
2222
- name: Setup Go
23-
uses: actions/setup-go@v5
23+
uses: actions/setup-go@v6
2424
with:
2525
go-version: ${{ matrix.go }}
2626

.golangci.yml

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,87 @@
1-
linters-settings:
2-
funlen:
3-
lines: 160
4-
statements: 72
5-
gci:
6-
sections:
7-
- standard
8-
- default
9-
- prefix(github.com/tiendc/gofn)
10-
gocyclo:
11-
min-complexity: 30
12-
goimports:
13-
local-prefixes: github.com/golangci/golangci-lint
14-
lll:
15-
line-length: 120
16-
misspell:
17-
locale: US
18-
1+
version: "2"
192
linters:
203
enable:
214
- bodyclose
225
- contextcheck
6+
- copyloopvar
237
- dogsled
24-
- errcheck
8+
- err113
259
- errname
2610
- errorlint
2711
- exhaustive
28-
- copyloopvar
2912
- forbidigo
3013
- forcetypeassert
3114
- funlen
32-
- gci
3315
- gocognit
3416
- goconst
3517
- gocritic
3618
- gocyclo
37-
- err113
38-
- gofmt
39-
- goimports
40-
- mnd
4119
- gosec
42-
- gosimple
43-
- govet
44-
- ineffassign
4520
- lll
4621
- misspell
22+
- mnd
4723
- nakedret
4824
- nestif
4925
- nilerr
5026
- rowserrcheck
5127
- staticcheck
52-
- stylecheck
53-
- typecheck
5428
- unconvert
5529
- unparam
56-
- unused
5730
- whitespace
5831
- wrapcheck
59-
60-
issues:
61-
exclude-rules:
62-
- path: _test\.go
63-
linters:
64-
- funlen
65-
- contextcheck
66-
- staticcheck
67-
- gocyclo
68-
- gocognit
69-
- err113
70-
- forcetypeassert
71-
- wrapcheck
72-
- mnd
32+
settings:
33+
funlen:
34+
lines: 120
35+
statements: 80
36+
gocognit:
37+
min-complexity: 20
38+
gocyclo:
39+
min-complexity: 20
40+
lll:
41+
line-length: 120
42+
misspell:
43+
locale: US
44+
exclusions:
45+
generated: lax
46+
presets:
47+
- comments
48+
- common-false-positives
49+
- legacy
50+
- std-error-handling
51+
rules:
52+
- linters:
53+
- contextcheck
54+
- err113
55+
- forcetypeassert
56+
- funlen
57+
- gocognit
58+
- gocyclo
59+
- gosec
60+
- mnd
61+
- staticcheck
62+
- wrapcheck
63+
path: _test\.go
64+
paths:
65+
- third_party$
66+
- builtin$
67+
- examples$
68+
formatters:
69+
enable:
70+
- gci
71+
- gofmt
72+
- goimports
73+
settings:
74+
gci:
75+
sections:
76+
- standard
77+
- default
78+
- prefix(github.com/tiendc/gofn)
79+
goimports:
80+
local-prefixes:
81+
- github.com/golangci/golangci-lint
82+
exclusions:
83+
generated: lax
84+
paths:
85+
- third_party$
86+
- builtin$
87+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: lint test
22

33
prepare:
4-
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.60.3
4+
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v2.6.0
55

66
build:
77
@go build -v ./...

slice_algo.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ func Chunk[T any, S ~[]T](s S, chunkSize int) []S {
6363
}
6464

6565
chunks := make([]S, 0, len(s)/chunkSize+1)
66-
for {
67-
if len(s) == 0 {
68-
break
69-
}
66+
for len(s) > 0 {
7067
if len(s) < chunkSize {
7168
chunkSize = len(s)
7269
}

util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "reflect"
44

55
// If returns the 2nd arg if the condition is true, 3rd arg otherwise.
66
// This is similar to C-language ternary operation (cond ? val1 : val2).
7+
//
78
// Deprecated: this function may cause unexpected behavior upon misuses.
89
//
910
// For example: gofn.If(len(slice) > 0, slice[0], defaultVal) will crash if slice is empty

0 commit comments

Comments
 (0)