Skip to content

Commit f1d6758

Browse files
chore(deps): bump github.com/golangci/golangci-lint from 1.63.4 to 1.64.8 in /tools (#93)
* chore(deps): bump github.com/golangci/golangci-lint in /tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.63.4 to 1.64.8. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/main/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.63.4...v1.64.8) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore: update to go1.24, use the mod tool directive, and lint --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moulard <tom.moulard@perfectstay.com>
1 parent 2ca8ea2 commit f1d6758

18 files changed

+1949
-2002
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
- uses: actions/setup-go@v5
2121
with:
22-
go-version: '1.22'
22+
go-version: '1.24'
2323

2424
- run: make inst
2525

.github/workflows/test-unit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- '*'
77

88
env:
9-
GO_VERSION: "1.22"
9+
GO_VERSION: "1.24"
1010

1111
jobs:
1212
test-unit:

.golangci.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ run:
44
linters:
55
enable-all: true
66
disable:
7-
- exportloopref # deprecated
8-
- varnamelen # useless
7+
- tenv # deprecated
98
- ireturn # Not relevant
109

1110
issues:
@@ -25,8 +24,14 @@ linters-settings:
2524
deny:
2625
- pkg: "github.com/instana/testify"
2726
desc: not allowed
27+
2828
tagliatelle:
2929
case:
3030
use-field-name: true
3131
rules:
3232
yaml: goPascal
33+
34+
varnamelen:
35+
ignore-decls:
36+
- rw http.ResponseWriter
37+
- rw *httptest.ResponseRecorder

.goreleaser.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ version: 2
33
before:
44
hooks:
55
- go mod download
6+
67
builds:
78
- skip: true
8-
archives:
9-
- format_overrides:
10-
- goos: windows
11-
format: zip
9+
1210
release:
1311
github: {}
1412
prerelease: auto
1513
mode: append
1614
footer: "**Full Changelog**: https://github.com/tomMoulard/htransformation/compare/{{ .PreviousTag }}...{{ .Tag }}"
15+
1716
changelog:
1817
use: github
1918
sort: asc

Makefile

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
.PHONY: default ci lint test yaegi_test vendor clean generate tidy spell inst vulncheck build
1+
.PHONY: default ci lint test yaegi_test vendor clean generate tidy spell vulncheck build
22

33
export GO111MODULE=on
44

55
default: spell lint build test
66

7-
ci: inst tidy generate default vulncheck
7+
ci: tidy generate default vulncheck
88

99
lint:
10-
goreleaser check
11-
golangci-lint run
10+
go tool goreleaser check
11+
go tool golangci-lint run
1212

1313
test:
1414
go test -race -cover ./...
1515

1616
yaegi_test:
17-
yaegi test .
17+
go tool yaegi test .
1818

1919
vendor:
2020
go mod vendor
@@ -27,17 +27,13 @@ generate:
2727

2828
tidy:
2929
go mod tidy
30-
cd tools && go mod tidy
3130

3231
spell:
33-
misspell -error -locale=US -w **.md
34-
35-
inst:
36-
cd tools && go install $(shell cd tools && go list -e -f '{{ join .Imports " " }}' -tags=tools)
32+
go tool misspell -error -locale=US -w **.md
3733

3834
vulncheck:
39-
govulncheck ./...
35+
go tool govulncheck ./...
4036

4137
build:
42-
goreleaser build --clean --single-target --snapshot
38+
go tool goreleaser build --clean --single-target --snapshot
4339

go.mod

+481-1
Large diffs are not rendered by default.

go.sum

+1,430
Large diffs are not rendered by default.

htransformation.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ func New(_ context.Context, next http.Handler, config *Config, name string) (htt
5454
return nil, fmt.Errorf("%w: %s", types.ErrInvalidRuleType, rule.Name)
5555
}
5656

57-
h, err := newHandler(rule)
57+
handler, err := newHandler(rule)
5858
if err != nil {
5959
return nil, fmt.Errorf("%w: %s", err, rule.Name)
6060
}
6161

62-
if err := h.Validate(); err != nil {
62+
if err := handler.Validate(); err != nil {
6363
return nil, fmt.Errorf("%w: %s", err, rule.Name)
6464
}
6565

6666
if rule.SetOnResponse {
67-
respHandlers = append(respHandlers, h)
67+
respHandlers = append(respHandlers, handler)
6868
} else {
69-
reqHandlers = append(reqHandlers, h)
69+
reqHandlers = append(reqHandlers, handler)
7070
}
7171
}
7272

htransformation_test.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package htransformation_test
22

33
import (
4-
"context"
54
"net/http"
65
"net/http/httptest"
76
"testing"
@@ -99,7 +98,7 @@ func TestValidation(t *testing.T) {
9998
t.Run(test.name, func(t *testing.T) {
10099
t.Parallel()
101100

102-
_, err := plug.New(context.Background(), nil, test.config, "test")
101+
_, err := plug.New(t.Context(), nil, test.config, "test")
103102
if test.wantErr {
104103
assert.Error(t, err)
105104
} else {
@@ -164,15 +163,14 @@ func TestHeaderRules(t *testing.T) {
164163
cfg := plug.CreateConfig()
165164
cfg.Rules = []types.Rule{test.rule}
166165

167-
ctx := context.Background()
168166
next := http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})
169167

170-
handler, err := plug.New(ctx, next, cfg, "demo-plugin")
168+
handler, err := plug.New(t.Context(), next, cfg, "demo-plugin")
171169
require.NoError(t, err)
172170

173171
recorder := httptest.NewRecorder()
174172

175-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost", nil)
173+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://localhost", nil)
176174
require.NoError(t, err)
177175

178176
for key, value := range test.additionalHeader {
@@ -239,18 +237,17 @@ func TestSetOnResponse(t *testing.T) {
239237
cfg := plug.CreateConfig()
240238
cfg.Rules = []types.Rule{test.rule}
241239

242-
ctx := context.Background()
243240
next := http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
244241
rw.Header().Add(test.headerName, test.headerValue)
245242
rw.WriteHeader(http.StatusOK)
246243
})
247244

248-
handler, err := plug.New(ctx, next, cfg, "demo-plugin")
245+
handler, err := plug.New(t.Context(), next, cfg, "demo-plugin")
249246
require.NoError(t, err)
250247

251248
recorder := httptest.NewRecorder()
252249

253-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost", nil)
250+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://localhost", nil)
254251
require.NoError(t, err)
255252

256253
handler.ServeHTTP(recorder, req)

pkg/handler/deleter/delete_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package deleter_test
22

33
import (
4-
"context"
54
"net/http"
65
"net/http/httptest"
76
"testing"
@@ -62,8 +61,7 @@ func TestDeleteHandler(t *testing.T) {
6261
t.Run(test.name, func(t *testing.T) {
6362
t.Parallel()
6463

65-
ctx := context.Background()
66-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://example.com/foo", nil)
64+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://example.com/foo", nil)
6765
require.NoError(t, err)
6866

6967
for hName, hVal := range test.requestHeaders {

pkg/handler/join/join_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package join_test
22

33
import (
4-
"context"
54
"net/http"
65
"testing"
76

@@ -193,8 +192,7 @@ func TestJoinHandler(t *testing.T) {
193192
t.Run(test.name, func(t *testing.T) {
194193
t.Parallel()
195194

196-
ctx := context.Background()
197-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://example.com/foo", nil)
195+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://example.com/foo", nil)
198196
require.NoError(t, err)
199197

200198
for hName, hVal := range test.requestHeaders {

pkg/handler/rename/rename_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package rename_test
22

33
import (
4-
"context"
54
"net/http"
65
"testing"
76

@@ -104,8 +103,7 @@ func TestRenameHandler(t *testing.T) {
104103
t.Run(test.name, func(t *testing.T) {
105104
t.Parallel()
106105

107-
ctx := context.Background()
108-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://example.com/foo", nil)
106+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://example.com/foo", nil)
109107
require.NoError(t, err)
110108

111109
for hName, hVal := range test.requestHeaders {

pkg/handler/rewrite/rewrite.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ type Rewrite struct {
1616
}
1717

1818
func New(rule types.Rule) (types.Handler, error) {
19-
re, err := regexp.Compile(rule.Header)
19+
reg, err := regexp.Compile(rule.Header)
2020
if err != nil {
2121
return nil, fmt.Errorf("%w: %s: %q", types.ErrInvalidRegexp, rule.Name, rule.Header)
2222
}
2323

24-
rule.Regexp = re
24+
rule.Regexp = reg
2525

26-
re, err = regexp.Compile(rule.Value)
26+
reg, err = regexp.Compile(rule.Value)
2727
if err != nil {
2828
return nil, fmt.Errorf("%w: %s: %q", types.ErrInvalidRegexp, rule.Name, rule.Value)
2929
}
3030

3131
return &Rewrite{
3232
rule: &rule,
33-
ruleValueRegexp: re,
33+
ruleValueRegexp: reg,
3434
}, nil
3535
}
3636

pkg/handler/rewrite/rewrite_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package rewrite_test
22

33
import (
4-
"context"
54
"net/http"
65
"testing"
76

@@ -115,8 +114,7 @@ func TestRewriteHandler(t *testing.T) {
115114
t.Run(test.name, func(t *testing.T) {
116115
t.Parallel()
117116

118-
ctx := context.Background()
119-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://example.com/foo", nil)
117+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://example.com/foo", nil)
120118
require.NoError(t, err)
121119

122120
for hName, hVal := range test.requestHeaders {

pkg/handler/set/set_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package set_test
22

33
import (
4-
"context"
54
"net/http"
65
"net/http/httptest"
76
"testing"
@@ -86,8 +85,7 @@ func TestSetHandler(t *testing.T) {
8685
t.Run(test.name, func(t *testing.T) {
8786
t.Parallel()
8887

89-
ctx := context.Background()
90-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://example.com/foo", nil)
88+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, "http://example.com/foo", nil)
9189
require.NoError(t, err)
9290

9391
for hName, hVal := range test.requestHeaders {

0 commit comments

Comments
 (0)