Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ linters:
#- name: unexported-return
- name: unreachable-code
- name: unused-parameter
severity: warning
disabled: true
#- name: unused-receiver
#- name: var-declaration
#- name: var-naming
Expand Down
2 changes: 1 addition & 1 deletion config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ func NewFileSecret(file string) *FileSecret {
return &FileSecret{file: file}
}

func (s *FileSecret) Fetch(ctx context.Context) (string, error) {
func (s *FileSecret) Fetch(context.Context) (string, error) {
fileBytes, err := os.ReadFile(s.file)
if err != nil {
return "", fmt.Errorf("unable to read file %s: %w", s.file, err)
Expand Down
16 changes: 8 additions & 8 deletions config/http_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestNewClientFromConfig(t *testing.T) {
InsecureSkipVerify: true,
},
},
handler: func(w http.ResponseWriter, r *http.Request) {
handler: func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
},
},
Expand All @@ -195,7 +195,7 @@ func TestNewClientFromConfig(t *testing.T) {
InsecureSkipVerify: false,
},
},
handler: func(w http.ResponseWriter, r *http.Request) {
handler: func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
},
},
Expand Down Expand Up @@ -933,7 +933,7 @@ type secretManager struct {
data map[string]string
}

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

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

handler := func(w http.ResponseWriter, r *http.Request) {
handler := func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
}
testServer, err := newTestServer(handler)
Expand Down Expand Up @@ -1162,7 +1162,7 @@ func TestTLSRoundTripper(t *testing.T) {
}

func TestTLSRoundTripper_Inline(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
handler := func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
}
testServer, err := newTestServer(handler)
Expand Down Expand Up @@ -1284,7 +1284,7 @@ func TestTLSRoundTripperRaces(t *testing.T) {

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

handler := func(w http.ResponseWriter, r *http.Request) {
handler := func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
}
testServer, err := newTestServer(handler)
Expand Down Expand Up @@ -1402,7 +1402,7 @@ type roundTrip struct {
theError error
}

func (rt *roundTrip) RoundTrip(r *http.Request) (*http.Response, error) {
func (rt *roundTrip) RoundTrip(*http.Request) (*http.Response, error) {
return rt.theResponse, rt.theError
}

Expand Down Expand Up @@ -1875,7 +1875,7 @@ func TestModifyTLSCertificates(t *testing.T) {
defer os.RemoveAll(tmpDir)
ca, cert, key := filepath.Join(tmpDir, "ca"), filepath.Join(tmpDir, "cert"), filepath.Join(tmpDir, "key")

handler := func(w http.ResponseWriter, r *http.Request) {
handler := func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, ExpectedMessage)
}
testServer, err := newTestServer(handler)
Expand Down
2 changes: 1 addition & 1 deletion expfmt/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ type errDecoder struct {
err error
}

func (d *errDecoder) Decode(v *dto.MetricFamily) error {
func (d *errDecoder) Decode(*dto.MetricFamily) error {
return d.err
}

Expand Down
2 changes: 1 addition & 1 deletion expfmt/text_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,6 @@ type errReader struct {
err error
}

func (r *errReader) Read(p []byte) (int, error) {
func (r *errReader) Read([]byte) (int, error) {
return 0, r.err
}
2 changes: 1 addition & 1 deletion promslog/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type Config struct {
}

func newGoKitStyleReplaceAttrFunc(lvl *Level) func(groups []string, a slog.Attr) slog.Attr {
return func(groups []string, a slog.Attr) slog.Attr {
return func(_ []string, a slog.Attr) slog.Attr {
key := a.Key
switch key {
case slog.TimeKey, "ts":
Expand Down
10 changes: 5 additions & 5 deletions route/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestRedirect(t *testing.T) {

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

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

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

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

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

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

r, err := http.NewRequest(http.MethodGet, "http://localhost:9090/foo", nil)
require.NoErrorf(t, err, "Error building test request: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion server/static_file_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

type dummyFileSystem struct{}

func (fs dummyFileSystem) Open(path string) (http.File, error) {
func (fs dummyFileSystem) Open(string) (http.File, error) {
return http.Dir(".").Open(".")
}

Expand Down
Loading