chore(lint): re-enable staticcheck and unused
golangci-lint v2.15.0 ships a honnef.co/go/tools that analyzes the Go 1.27 standard library without panicking. Fix what they found: dead helpers, an unused constant, error strings starting with a product name, the usage error, and two negations simplified by De Morgan. Closes #43 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
1ad68e2e87
commit
d58e3e2653
14 files changed
+20
-25
No files matched your search
@@ -177,7 +177,7 @@ func (s *Server) audit() gin.HandlerFunc {
|
||||
|
||||
action := auditActions[c.Request.Method+" "+c.FullPath()]
|
||||
status := c.Writer.Status()
|
||||
if action == "" || c.GetBool(ctxAuditSkip) || (status >= 400 && !(auditFailures[action] && status < 500)) {
|
||||
if action == "" || c.GetBool(ctxAuditSkip) || (status >= 400 && (!auditFailures[action] || status >= 500)) {
|
||||
return
|
||||
}
|
||||
if status >= 400 {
|
||||
|
||||
@@ -68,9 +68,6 @@ func (t groupTree) resources(group *uuid.UUID) []authz.Resource {
|
||||
return out
|
||||
}
|
||||
|
||||
// depth returns how many ancestors a group has.
|
||||
func (t groupTree) depth(id uuid.UUID) int { return len(t.resources(&id)) - 1 }
|
||||
|
||||
// walk visits groups depth-first in name order.
|
||||
func (t groupTree) walk(fn func(g store.MonitorGroup, depth int)) {
|
||||
var visit func(ids []uuid.UUID, depth int)
|
||||
|
||||
@@ -114,7 +114,7 @@ var emailProviders = []Provider{
|
||||
AccessToken string `json:"access_token"`
|
||||
}
|
||||
if json.Unmarshal(reply, &tok) != nil || tok.AccessToken == "" {
|
||||
return errors.New("Microsoft Entra issued no access token")
|
||||
return errors.New("no access token from Microsoft Entra")
|
||||
}
|
||||
recipients := func(s string) []any {
|
||||
return addresses(s, func(a string) any { return map[string]any{"emailAddress": map[string]string{"address": a}} })
|
||||
|
||||
@@ -124,7 +124,7 @@ var incidentProviders = []Provider{
|
||||
ID string `json:"id"`
|
||||
}
|
||||
if json.Unmarshal(reply, &alert) != nil || alert.ID == "" {
|
||||
return errors.New("Jira Service Management: alert to close not found")
|
||||
return errors.New("alert to close not found in Jira Service Management")
|
||||
}
|
||||
return c.json(ctx, http.MethodPost, base+"/"+url.PathEscape(alert.ID)+"/close", h, map[string]any{"source": "UptimeSebi"})
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ var smsProviders = []Provider{
|
||||
} `json:"data"`
|
||||
}
|
||||
if err != nil || json.Unmarshal(reply, &login) != nil || !login.Success {
|
||||
return errors.Join(errors.New("Teltonika: sign-in failed"), err)
|
||||
return errors.Join(errors.New("sign-in to Teltonika failed"), err)
|
||||
}
|
||||
reply, err = c.callJSON(ctx, http.MethodPost, base+"/api/messages/actions/send", bearer(login.Data.Token), map[string]any{
|
||||
"data": map[string]any{"modem": cfg["modem"], "number": cfg["phone_number"], "message": truncate(m.sms(), 159)},
|
||||
|
||||
+2
-3
@@ -21,11 +21,10 @@ const (
|
||||
margin = 50.0
|
||||
bodySize = 9.0
|
||||
lineHeight = 12.0
|
||||
// Courier advances 0.6 em per character, which makes wrapping exact.
|
||||
charWidth = 0.6 * bodySize
|
||||
)
|
||||
|
||||
// maxChars is how many Courier characters fit on a line.
|
||||
// maxChars is how many Courier characters fit on a line: Courier advances
|
||||
// 0.6 em per character, which makes wrapping exact.
|
||||
const maxChars = 91
|
||||
|
||||
type font string
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ func (c *Client) checkIssuer(issuer string) error {
|
||||
if err != nil || u.Host == "" || u.RawQuery != "" || u.Fragment != "" || u.User != nil {
|
||||
return ErrInvalidIssuer
|
||||
}
|
||||
if u.Scheme != "https" && !(c.allowHTTP && u.Scheme == "http") {
|
||||
if u.Scheme != "https" && (!c.allowHTTP || u.Scheme != "http") {
|
||||
return ErrInvalidIssuer
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -55,12 +55,6 @@ func (f *fakeSource) set(fn func(*fakeSource)) {
|
||||
fn(f)
|
||||
}
|
||||
|
||||
func (f *fakeSource) callCount() int {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return f.calls
|
||||
}
|
||||
|
||||
type harness struct {
|
||||
srv *Server
|
||||
src *fakeSource
|
||||
|
||||
Reference in new issue
Block a user