From 9c9bc65db82818993897209eb04a7defd76bc2b0 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Thu, 14 May 2026 09:57:12 +0700 Subject: [PATCH] fix(ci): clear sam lint + golangci-lint findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - template.yaml: drop redundant DependsOn (W3005) — Ref in LoggingConfig already implies BotFunctionLogGroup ordering. - dynamodb_kv.go: remove unused errIsTableMissing and orphaned errors import. - trading/prices.go: wrap deferred resp.Body.Close to satisfy errcheck. --- internal/modules/trading/prices.go | 2 +- internal/storage/dynamodb_kv.go | 8 -------- template.yaml | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/internal/modules/trading/prices.go b/internal/modules/trading/prices.go index b1a1362..70de4d9 100644 --- a/internal/modules/trading/prices.go +++ b/internal/modules/trading/prices.go @@ -87,7 +87,7 @@ func (c *PriceClient) FetchPrice(ctx context.Context, ticker string) (float64, e if err != nil { return 0, fmt.Errorf("trading: KBS request: %w", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode < 200 || resp.StatusCode >= 300 { return 0, ErrNoPrice diff --git a/internal/storage/dynamodb_kv.go b/internal/storage/dynamodb_kv.go index 4e8b7a9..5bdc418 100644 --- a/internal/storage/dynamodb_kv.go +++ b/internal/storage/dynamodb_kv.go @@ -3,7 +3,6 @@ package storage import ( "context" "encoding/json" - "errors" "fmt" "strconv" "time" @@ -183,10 +182,3 @@ func (s *DynamoDBKVStore) List(ctx context.Context, prefix string) ([]string, er return keys, nil } -// errIsNotFound wraps the SDK NotFound condition. DynamoDB GetItem doesn't -// return an error for missing items (returns empty Item), but other ops may -// surface ResourceNotFoundException for missing tables. -func errIsTableMissing(err error) bool { - var rnfe *types.ResourceNotFoundException - return errors.As(err, &rnfe) -} diff --git a/template.yaml b/template.yaml index ca7d626..219bd4b 100644 --- a/template.yaml +++ b/template.yaml @@ -101,7 +101,6 @@ Resources: BotFunction: Type: AWS::Serverless::Function - DependsOn: BotFunctionLogGroup Properties: FunctionName: !Sub "${AWS::StackName}-bot" CodeUri: build/lambda/