Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit 862c7ef

Browse files
authored
Merge pull request #13 from gripmock/golangci-v2
Golangci v2
2 parents a53a306 + c876f63 commit 862c7ef

File tree

8 files changed

+71
-43
lines changed

8 files changed

+71
-43
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
go-version: [ '1.22' ]
15+
go-version: [ '1.24' ]
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Setup Go
@@ -21,6 +21,6 @@ jobs:
2121
go-version: ${{ matrix.go-version }}
2222
cache: true
2323
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v6
24+
uses: golangci/golangci-lint-action@v7
2525
with:
26-
version: v1.59.1
26+
version: v2.0.2

.github/workflows/unit.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
name: Unit
22
on:
33
pull_request:
4+
branches:
5+
- master
46

57
jobs:
68
test:
79
runs-on: ubuntu-latest
810
strategy:
911
matrix:
10-
go-version: [ '1.22', '1.23' ]
12+
go-version: [ '1.24' ]
1113
steps:
12-
-
13-
name: Checkout
14-
uses: actions/checkout@v4
14+
- uses: actions/checkout@v4
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
1818
go-version: ${{ matrix.go-version }}
1919
cache: true
20+
- name: Install dependencies
21+
run: go get .
2022
- name: Test with Go
21-
run: go test ./...
23+
run: go test -json ./... 2>&1 | tee -a TestResults-${{ matrix.go-version }}.json
24+
- name: Upload Go test results
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: Go-results-${{ matrix.go-version }}
28+
path: TestResults-${{ matrix.go-version }}.json

.golangci.yml

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,54 @@
1-
run:
2-
go: "1.22"
3-
timeout: 1m
1+
version: "2"
42
linters:
5-
enable-all: true
3+
default: all
64
disable:
7-
# deprecated
8-
- execinquery
9-
- gomnd
10-
# not relevant
11-
- wrapcheck
12-
- paralleltest
135
- exhaustruct
6+
- godox
7+
- paralleltest
8+
- varnamelen
9+
- wrapcheck
1410
- tagalign
15-
linters-settings:
16-
lll:
17-
line-length: 140
18-
gci:
19-
sections:
20-
- Standard
21-
- Default
22-
- Prefix(github.com/gripmock)
23-
depguard:
11+
settings:
12+
depguard:
13+
rules:
14+
main:
15+
allow:
16+
- $gostd
17+
- github.com
18+
- golang.org
19+
- google.golang.org
20+
lll:
21+
line-length: 140
22+
exclusions:
23+
generated: lax
24+
presets:
25+
- comments
26+
- common-false-positives
27+
- legacy
28+
- std-error-handling
2429
rules:
25-
main:
26-
allow:
27-
- $gostd
28-
- github.com
29-
issues:
30-
exclude-rules:
31-
- path: (.+)_test.go
32-
linters:
33-
- dupl
30+
- linters:
31+
- dupl
32+
path: (.+)_test.go
33+
paths:
34+
- third_party$
35+
- builtin$
36+
- examples$
37+
formatters:
38+
enable:
39+
- gci
40+
- gofmt
41+
- gofumpt
42+
- goimports
43+
settings:
44+
gci:
45+
sections:
46+
- Standard
47+
- Default
48+
- Prefix(github.com/gripmock)
49+
exclusions:
50+
generated: lax
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test:
44
go test -tags mock -race -cover ./...
55

66
lint:
7-
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run --color always ${args}
7+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2 run --color always ${args}
88

99
lint-fix:
1010
make lint args=--fix

env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package environment
33
import (
44
"time"
55

6-
env "github.com/caarlos0/env/v10"
6+
env "github.com/caarlos0/env/v11"
77
)
88

99
type watcherType string

env_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package environment_test
22

33
import (
4-
"os"
54
"testing"
65

76
"github.com/stretchr/testify/require"
@@ -43,8 +42,7 @@ func TestConfig_Override(t *testing.T) {
4342
}
4443

4544
for k, v := range env {
46-
err := os.Setenv(k, v)
47-
require.NoError(t, err)
45+
t.Setenv(k, v)
4846
}
4947

5048
conf, err := environment.New()

go.mod

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

3-
go 1.22.1
3+
go 1.24
44

55
require (
6-
github.com/caarlos0/env/v10 v10.0.0
6+
github.com/caarlos0/env/v11 v11.3.1
77
github.com/stretchr/testify v1.10.0
88
)
99

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/caarlos0/env/v10 v10.0.0 h1:yIHUBZGsyqCnpTkbjk8asUlx6RFhhEs+h7TOBdgdzXA=
22
github.com/caarlos0/env/v10 v10.0.0/go.mod h1:ZfulV76NvVPw3tm591U4SwL3Xx9ldzBP9aGxzeN7G18=
3+
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
4+
github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
35
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
46
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

0 commit comments

Comments
 (0)