Skip to content

Commit 7937ffb

Browse files
authored
Enable revive rule unused-parameter (#824)
Signed-off-by: Arve Knudsen <[email protected]>
1 parent 6d40fe1 commit 7937ffb

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ linters:
151151
#- name: unexported-return
152152
- name: unreachable-code
153153
- name: unused-parameter
154-
severity: warning
155-
disabled: true
156154
#- name: unused-receiver
157155
#- name: var-declaration
158156
#- name: var-naming

config/http_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ func NewFileSecret(file string) *FileSecret {
742742
return &FileSecret{file: file}
743743
}
744744

745-
func (s *FileSecret) Fetch(ctx context.Context) (string, error) {
745+
func (s *FileSecret) Fetch(context.Context) (string, error) {
746746
fileBytes, err := os.ReadFile(s.file)
747747
if err != nil {
748748
return "", fmt.Errorf("unable to read file %s: %w", s.file, err)

config/http_config_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func TestNewClientFromConfig(t *testing.T) {
181181
InsecureSkipVerify: true,
182182
},
183183
},
184-
handler: func(w http.ResponseWriter, r *http.Request) {
184+
handler: func(w http.ResponseWriter, _ *http.Request) {
185185
fmt.Fprint(w, ExpectedMessage)
186186
},
187187
},
@@ -195,7 +195,7 @@ func TestNewClientFromConfig(t *testing.T) {
195195
InsecureSkipVerify: false,
196196
},
197197
},
198-
handler: func(w http.ResponseWriter, r *http.Request) {
198+
handler: func(w http.ResponseWriter, _ *http.Request) {
199199
fmt.Fprint(w, ExpectedMessage)
200200
},
201201
},
@@ -933,7 +933,7 @@ type secretManager struct {
933933
data map[string]string
934934
}
935935

936-
func (m *secretManager) Fetch(ctx context.Context, secretRef string) (string, error) {
936+
func (m *secretManager) Fetch(_ context.Context, secretRef string) (string, error) {
937937
secretData, ok := m.data[secretRef]
938938
if !ok {
939939
return "", fmt.Errorf("unknown secret %s", secretRef)
@@ -1044,7 +1044,7 @@ func TestTLSRoundTripper(t *testing.T) {
10441044

10451045
ca, cert, key := filepath.Join(tmpDir, "ca"), filepath.Join(tmpDir, "cert"), filepath.Join(tmpDir, "key")
10461046

1047-
handler := func(w http.ResponseWriter, r *http.Request) {
1047+
handler := func(w http.ResponseWriter, _ *http.Request) {
10481048
fmt.Fprint(w, ExpectedMessage)
10491049
}
10501050
testServer, err := newTestServer(handler)
@@ -1162,7 +1162,7 @@ func TestTLSRoundTripper(t *testing.T) {
11621162
}
11631163

11641164
func TestTLSRoundTripper_Inline(t *testing.T) {
1165-
handler := func(w http.ResponseWriter, r *http.Request) {
1165+
handler := func(w http.ResponseWriter, _ *http.Request) {
11661166
fmt.Fprint(w, ExpectedMessage)
11671167
}
11681168
testServer, err := newTestServer(handler)
@@ -1284,7 +1284,7 @@ func TestTLSRoundTripperRaces(t *testing.T) {
12841284

12851285
ca, cert, key := filepath.Join(tmpDir, "ca"), filepath.Join(tmpDir, "cert"), filepath.Join(tmpDir, "key")
12861286

1287-
handler := func(w http.ResponseWriter, r *http.Request) {
1287+
handler := func(w http.ResponseWriter, _ *http.Request) {
12881288
fmt.Fprint(w, ExpectedMessage)
12891289
}
12901290
testServer, err := newTestServer(handler)
@@ -1403,7 +1403,7 @@ type roundTrip struct {
14031403
theError error
14041404
}
14051405

1406-
func (rt *roundTrip) RoundTrip(r *http.Request) (*http.Response, error) {
1406+
func (rt *roundTrip) RoundTrip(*http.Request) (*http.Response, error) {
14071407
return rt.theResponse, rt.theError
14081408
}
14091409

@@ -1876,7 +1876,7 @@ func TestModifyTLSCertificates(t *testing.T) {
18761876
defer os.RemoveAll(tmpDir)
18771877
ca, cert, key := filepath.Join(tmpDir, "ca"), filepath.Join(tmpDir, "cert"), filepath.Join(tmpDir, "key")
18781878

1879-
handler := func(w http.ResponseWriter, r *http.Request) {
1879+
handler := func(w http.ResponseWriter, _ *http.Request) {
18801880
fmt.Fprint(w, ExpectedMessage)
18811881
}
18821882
testServer, err := newTestServer(handler)

expfmt/decode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ type errDecoder struct {
135135
err error
136136
}
137137

138-
func (d *errDecoder) Decode(v *dto.MetricFamily) error {
138+
func (d *errDecoder) Decode(*dto.MetricFamily) error {
139139
return d.err
140140
}
141141

expfmt/text_parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,6 @@ type errReader struct {
10481048
err error
10491049
}
10501050

1051-
func (r *errReader) Read(p []byte) (int, error) {
1051+
func (r *errReader) Read([]byte) (int, error) {
10521052
return 0, r.err
10531053
}

promslog/slog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ type Config struct {
147147
}
148148

149149
func newGoKitStyleReplaceAttrFunc(lvl *Level) func(groups []string, a slog.Attr) slog.Attr {
150-
return func(groups []string, a slog.Attr) slog.Attr {
150+
return func(_ []string, a slog.Attr) slog.Attr {
151151
key := a.Key
152152
switch key {
153153
case slog.TimeKey, "ts":

route/route_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestRedirect(t *testing.T) {
3737

3838
func TestContext(t *testing.T) {
3939
router := New()
40-
router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) {
40+
router.Get("/test/:foo/", func(_ http.ResponseWriter, r *http.Request) {
4141
want := "bar"
4242
got := Param(r.Context(), "foo")
4343
require.Equalf(t, want, got, "Unexpected context value: want %q, got %q", want, got)
@@ -50,7 +50,7 @@ func TestContext(t *testing.T) {
5050

5151
func TestContextWithValue(t *testing.T) {
5252
router := New()
53-
router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) {
53+
router.Get("/test/:foo/", func(_ http.ResponseWriter, r *http.Request) {
5454
want := "bar"
5555
got := Param(r.Context(), "foo")
5656
require.Equalf(t, want, got, "Unexpected context value: want %q, got %q", want, got)
@@ -79,7 +79,7 @@ func TestContextWithValue(t *testing.T) {
7979

8080
func TestContextWithoutValue(t *testing.T) {
8181
router := New()
82-
router.Get("/test", func(w http.ResponseWriter, r *http.Request) {
82+
router.Get("/test", func(_ http.ResponseWriter, r *http.Request) {
8383
want := ""
8484
got := Param(r.Context(), "foo")
8585
require.Equalf(t, want, got, "Unexpected context value: want %q, got %q", want, got)
@@ -109,7 +109,7 @@ func TestInstrumentation(t *testing.T) {
109109
}
110110

111111
for _, c := range cases {
112-
c.router.Get("/foo", func(w http.ResponseWriter, r *http.Request) {})
112+
c.router.Get("/foo", func(_ http.ResponseWriter, _ *http.Request) {})
113113

114114
r, err := http.NewRequest(http.MethodGet, "http://localhost:9090/foo", nil)
115115
require.NoErrorf(t, err, "Error building test request: %s", err)
@@ -149,7 +149,7 @@ func TestInstrumentations(t *testing.T) {
149149
}
150150

151151
for _, c := range cases {
152-
c.router.Get("/foo", func(w http.ResponseWriter, r *http.Request) {})
152+
c.router.Get("/foo", func(_ http.ResponseWriter, _ *http.Request) {})
153153

154154
r, err := http.NewRequest(http.MethodGet, "http://localhost:9090/foo", nil)
155155
require.NoErrorf(t, err, "Error building test request: %s", err)

server/static_file_server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
type dummyFileSystem struct{}
2525

26-
func (fs dummyFileSystem) Open(path string) (http.File, error) {
26+
func (fs dummyFileSystem) Open(string) (http.File, error) {
2727
return http.Dir(".").Open(".")
2828
}
2929

0 commit comments

Comments
 (0)