Skip to content

Commit a3265b6

Browse files
committed
Migrate to golangci-lint v2.
Signed-off-by: SuperQ <[email protected]>
1 parent 4d6cd50 commit a3265b6

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

.golangci.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
---
1+
version: "2"
22
linters:
33
enable:
44
- misspell
55
- revive
66
- sloglint
7-
8-
linters-settings:
9-
errcheck:
10-
exclude-functions:
11-
# Don't flag lines such as "io.Copy(io.Discard, resp.Body)".
12-
- io.Copy
13-
# Used in HTTP handlers, any error is handled by the server itself.
14-
- (net/http.ResponseWriter).Write
15-
revive:
16-
rules:
17-
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
18-
- name: unused-parameter
19-
severity: warning
20-
disabled: true
7+
settings:
8+
errcheck:
9+
exclude-functions:
10+
- io.Copy
11+
- (net/http.ResponseWriter).Write
12+
revive:
13+
rules:
14+
- name: unused-parameter
15+
severity: warning
16+
disabled: true
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- comments
21+
- common-false-positives
22+
- legacy
23+
- std-error-handling
24+
formatters:
25+
exclusions:
26+
generated: lax

cmd/proxy/coordinator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (c *Coordinator) DoScrape(ctx context.Context, r *http.Request) (*http.Resp
115115
r.Header.Add("Id", id)
116116
select {
117117
case <-ctx.Done():
118-
return nil, fmt.Errorf("Timeout reached for %q: %s", r.URL.String(), ctx.Err())
118+
return nil, fmt.Errorf("timeout reached for %q: %s", r.URL.String(), ctx.Err())
119119
case c.getRequestChannel(r.URL.Hostname()) <- r:
120120
}
121121

cmd/proxy/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (h *httpHandler) handlePoll(w http.ResponseWriter, r *http.Request) {
145145
request, err := h.coordinator.WaitForScrapeInstruction(strings.TrimSpace(string(fqdn)))
146146
if err != nil {
147147
h.logger.Info("Error WaitForScrapeInstruction:", "err", err)
148-
http.Error(w, fmt.Sprintf("Error WaitForScrapeInstruction: %s", err.Error()), 408)
148+
http.Error(w, fmt.Sprintf("Error WaitForScrapeInstruction: %s", err.Error()), http.StatusRequestTimeout)
149149
return
150150
}
151151
//nolint:errcheck // https://github.com/prometheus-community/PushProx/issues/111

0 commit comments

Comments
 (0)