From 419acc6c38bc73687d2e062ee4d3b5183c4a9d4a Mon Sep 17 00:00:00 2001 From: theworker02 Date: Mon, 3 Aug 2026 16:24:33 -0400 Subject: [PATCH] Fix staticcheck ST1005, U1000, and SA1012 lint failures. Co-authored-by: Cursor --- cmd/shiftlock/main.go | 4 ++-- resource/database/postgres/postgres.go | 4 +--- resource/ratelimit/ratelimit_test.go | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/shiftlock/main.go b/cmd/shiftlock/main.go index c00a217..ea05cae 100644 --- a/cmd/shiftlock/main.go +++ b/cmd/shiftlock/main.go @@ -244,7 +244,7 @@ func cmdCapabilities(args []string) error { func cmdSecurity(args []string) error { if len(args) == 0 || args[0] != "scan" { - return fmt.Errorf("usage: shiftlock security scan [-format text|json|sarif] [-production] ...") + return fmt.Errorf("usage: shiftlock security scan [-format text|json|sarif] [-production]") } fs := flag.NewFlagSet("security scan", flag.ExitOnError) format := fs.String("format", "text", "text|json|sarif") @@ -369,7 +369,7 @@ func cmdIncident(args []string) error { func cmdSnapshot(args []string) error { if len(args) == 0 { - return fmt.Errorf("usage: shiftlock snapshot create|diff ...") + return fmt.Errorf("usage: shiftlock snapshot create|diff") } switch args[0] { case "create": diff --git a/resource/database/postgres/postgres.go b/resource/database/postgres/postgres.go index 0b4b57b..e6c4143 100644 --- a/resource/database/postgres/postgres.go +++ b/resource/database/postgres/postgres.go @@ -9,7 +9,6 @@ import ( "database/sql" "errors" "fmt" - "sync" "sync/atomic" "time" @@ -52,8 +51,7 @@ type Config struct { // Resource implements resource.Resource for PostgreSQL (or any SQL DB). type Resource struct { - cfg Config - mu sync.Mutex + cfg Config drained atomic.Bool } diff --git a/resource/ratelimit/ratelimit_test.go b/resource/ratelimit/ratelimit_test.go index ef31d68..039e4bf 100644 --- a/resource/ratelimit/ratelimit_test.go +++ b/resource/ratelimit/ratelimit_test.go @@ -1,6 +1,7 @@ package ratelimit import ( + "context" "testing" "github.com/theworker02/shiftlock/resource" @@ -26,7 +27,7 @@ func TestTokenBucket(t *testing.T) { } r.Release() r.Release() - snap, _ := r.Snapshot(nil) + snap, _ := r.Snapshot(context.TODO()) if snap["rejected"] == "0" { t.Fatal("expected rejection counted") }