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") }