From e3ba8b5b8b2b49bafb3846932ec6f3b03cfe4ece Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 20:37:01 -0700 Subject: [PATCH 1/7] fix: update dependencies Co-authored-by: Copilot --- Dockerfile | 5 +- README.md | 2 +- Taskfile.yml | 10 +++ cmd/clean_test.go | 21 +++--- cmd/root_test.go | 13 ++-- go.mod | 76 +++++++++---------- go.sum | 188 ++++++++++++++++++++-------------------------- 7 files changed, 147 insertions(+), 168 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1096f8..e9270a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) karl-cardenas-coding # SPDX-License-Identifier: MIT -FROM golang:1.26.0-alpine3.22 AS builder +FROM golang:1.26.1-alpine3.23 AS builder LABEL org.opencontainers.image.source="http://github.com/karl-cardenas-coding/go-lambda-cleanup" LABEL org.opencontainers.image.description="A solution for removing previous versions of AWS Lambdas" @@ -13,13 +13,12 @@ RUN cd /source && \ adduser -H -u 1002 -D appuser appuser && \ go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${VERSION}'" -o glc -v -FROM alpine:latest +FROM dhi.io/alpine-base:3.23 COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /etc/group /etc/group COPY --from=builder --chown=appuser:appuser /source/glc /usr/bin/ -RUN apk -U upgrade --no-cache USER appuser ENTRYPOINT ["/usr/bin/glc"] diff --git a/README.md b/README.md index cc73886..93664c5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ go-lambda-cleanup is distributed as a single binary. [Download](https://github.com/karl-cardenas-coding/go-lambda-cleanup/releases) the binary and install go-lambda-cleanup in a directory in your system's [PATH](https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them). `/usr/local/bin` is the recommended path for UNIX/LINUX environments. ```shell -VERSION=2.0.19 +VERSION=2.0.20 wget https://github.com/karl-cardenas-coding/go-lambda-cleanup/releases/download/v$VERSION/go-lambda-cleanup-v$VERSION-linux-amd64.zip unzip go-lambda-cleanup-v$VERSION-linux-amd64.zip sudo mv glc /usr/local/bin/ diff --git a/Taskfile.yml b/Taskfile.yml index 68772f2..f7aad6c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -46,3 +46,13 @@ tasks: desc: Check for nil errors cmds: - ~/go/bin/nilaway ./... + + docker-build: + desc: Build the Docker image + cmds: + - docker build -t go-lambda-cleanup:latest . + + fmt: + desc: Format the code + cmds: + - go fmt ./... diff --git a/cmd/clean_test.go b/cmd/clean_test.go index 868875a..3f4542d 100644 --- a/cmd/clean_test.go +++ b/cmd/clean_test.go @@ -22,7 +22,6 @@ import ( "github.com/aws/aws-sdk-go-v2/credentials" "github.com/aws/aws-sdk-go-v2/service/lambda" "github.com/aws/aws-sdk-go-v2/service/lambda/types" - "github.com/docker/go-connections/nat" log "github.com/sirupsen/logrus" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/localstack" @@ -1176,7 +1175,7 @@ func TestCleanCMDDryRun(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -1244,7 +1243,7 @@ func TestCleanCMDDryRun(t *testing.T) { t.Logf("Pre-Clean # of versions: %v", len(versions)) - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") @@ -1320,7 +1319,7 @@ func TestCleanCMD(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -1388,7 +1387,7 @@ func TestCleanCMD(t *testing.T) { t.Logf("Pre-Clean # of versions: %v", len(versions)) - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") @@ -1464,7 +1463,7 @@ func TestCleanCMDWithCustomList(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -1532,7 +1531,7 @@ func TestCleanCMDWithCustomList(t *testing.T) { t.Logf("Pre-Clean # of versions: %v", len(versions)) - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") @@ -1772,7 +1771,7 @@ THE CODE BELOW IS FOR TESTING PURPOSES ONLY // lambdaClient returns a lambda client configured to use the localstack containers func lambdaClient(ctx context.Context, l *localstack.LocalStackContainer) (*lambda.Client, error) { - mappedPort, err := l.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := l.MappedPort(ctx, "4566/tcp") if err != nil { return nil, err } @@ -1798,7 +1797,7 @@ func lambdaClient(ctx context.Context, l *localstack.LocalStackContainer) (*lamb } client := lambda.NewFromConfig(awsCfg, func(o *lambda.Options) { - o.BaseEndpoint = aws.String(fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + o.BaseEndpoint = aws.String(fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) }) return client, nil @@ -1907,7 +1906,7 @@ func getAWSCredentials(ctx context.Context, l *localstack.LocalStackContainer) ( return nil, err } - mappedPort, err := l.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := l.MappedPort(ctx, "4566/tcp") if err != nil { return nil, err } @@ -1922,7 +1921,7 @@ func getAWSCredentials(ctx context.Context, l *localstack.LocalStackContainer) ( } return lambda.NewFromConfig(awsCfg, func(o *lambda.Options) { - o.BaseEndpoint = aws.String(fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + o.BaseEndpoint = aws.String(fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) }), nil } diff --git a/cmd/root_test.go b/cmd/root_test.go index 8af9641..79bf7cc 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -13,7 +13,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/lambda/types" - "github.com/docker/go-connections/nat" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/localstack" "github.com/testcontainers/testcontainers-go/network" @@ -61,7 +60,7 @@ func TestRootCMD(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -119,7 +118,7 @@ func TestRootCMD(t *testing.T) { t.Logf("Pre-Clean # of versions: %v", len(versions)) - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") @@ -193,7 +192,7 @@ func TestRootExecute(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -251,7 +250,7 @@ func TestRootExecute(t *testing.T) { t.Logf("Pre-Clean # of versions: %v", len(versions)) - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") @@ -322,7 +321,7 @@ func TestNoLambdas(t *testing.T) { panic(err) } - mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + mappedPort, err := localstackContainer.MappedPort(ctx, "4566/tcp") if err != nil { panic(err) } @@ -346,7 +345,7 @@ func TestNoLambdas(t *testing.T) { Retain: aws.Int8(0), } - os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%s", host, mappedPort.Port())) os.Setenv("AWS_EC2_METADATA_DISABLED", "true") os.Setenv("AWS_ACCESS_KEY_ID", "test") os.Setenv("AWS_SECRET_ACCESS_KEY", "test") diff --git a/go.mod b/go.mod index 6f32adc..6da2d96 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,19 @@ module github.com/karl-cardenas-coding/go-lambda-cleanup/v2 -go 1.26.0 +go 1.26.1 require ( - github.com/aws/aws-sdk-go-v2 v1.41.1 - github.com/aws/aws-sdk-go-v2/config v1.32.7 - github.com/aws/aws-sdk-go-v2/credentials v1.19.7 - github.com/aws/aws-sdk-go-v2/service/lambda v1.88.0 - github.com/docker/go-connections v0.6.0 + github.com/aws/aws-sdk-go-v2 v1.41.6 + github.com/aws/aws-sdk-go-v2/config v1.32.16 + github.com/aws/aws-sdk-go-v2/credentials v1.19.15 + github.com/aws/aws-sdk-go-v2/service/lambda v1.90.0 github.com/dustin/go-humanize v1.0.1 - github.com/hashicorp/go-version v1.8.0 + github.com/hashicorp/go-version v1.9.0 github.com/sirupsen/logrus v1.9.4 github.com/spf13/cobra v1.10.2 - github.com/testcontainers/testcontainers-go v0.40.0 - github.com/testcontainers/testcontainers-go/modules/localstack v0.40.0 - golang.org/x/time v0.14.0 + github.com/testcontainers/testcontainers-go v0.42.0 + github.com/testcontainers/testcontainers-go/modules/localstack v0.42.0 + golang.org/x/time v0.15.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -22,18 +21,18 @@ require ( dario.cat/mergo v1.0.2 // indirect github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect - github.com/aws/smithy-go v1.24.0 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.23 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.8 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.22 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.10 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.16 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.20 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.42.0 // indirect + github.com/aws/smithy-go v1.25.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/containerd/errdefs v1.0.0 // indirect @@ -43,46 +42,43 @@ require ( github.com/cpuguy83/dockercfg v0.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/docker/docker v28.5.2+incompatible // indirect + github.com/docker/go-connections v0.7.0 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/ebitengine/purego v0.9.1 // indirect + github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/klauspost/compress v1.18.4 // indirect - github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect + github.com/klauspost/compress v1.18.5 // indirect + github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/go-archive v0.2.0 // indirect - github.com/moby/patternmatcher v0.6.0 // indirect + github.com/moby/moby/api v1.54.2 // indirect + github.com/moby/moby/client v0.4.1 // indirect + github.com/moby/patternmatcher v0.6.1 // indirect github.com/moby/sys/sequential v0.6.0 // indirect github.com/moby/sys/user v0.4.0 // indirect github.com/moby/sys/userns v0.1.0 // indirect github.com/moby/term v0.5.2 // indirect - github.com/morikuni/aec v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect - github.com/shirou/gopsutil/v4 v4.26.1 // indirect + github.com/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stretchr/testify v1.11.1 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect - go.opentelemetry.io/otel v1.40.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect - go.opentelemetry.io/otel/metric v1.40.0 // indirect - go.opentelemetry.io/otel/trace v1.40.0 // indirect - golang.org/x/crypto v0.48.0 // indirect - golang.org/x/mod v0.33.0 // indirect - golang.org/x/sys v0.41.0 // indirect - google.golang.org/grpc v1.79.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect + go.opentelemetry.io/otel v1.43.0 // indirect + go.opentelemetry.io/otel/metric v1.43.0 // indirect + go.opentelemetry.io/otel/trace v1.43.0 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/mod v0.35.0 // indirect + golang.org/x/sys v0.43.0 // indirect ) diff --git a/go.sum b/go.sum index 9010824..b10f4e7 100644 --- a/go.sum +++ b/go.sum @@ -6,42 +6,40 @@ github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEK github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/aws/aws-sdk-go-v2 v1.41.1 h1:ABlyEARCDLN034NhxlRUSZr4l71mh+T5KAeGh6cerhU= -github.com/aws/aws-sdk-go-v2 v1.41.1/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4/go.mod h1:IOAPF6oT9KCsceNTvvYMNHy0+kMF8akOjeDvPENWxp4= -github.com/aws/aws-sdk-go-v2/config v1.32.7 h1:vxUyWGUwmkQ2g19n7JY/9YL8MfAIl7bTesIUykECXmY= -github.com/aws/aws-sdk-go-v2/config v1.32.7/go.mod h1:2/Qm5vKUU/r7Y+zUk/Ptt2MDAEKAfUtKc1+3U1Mo3oY= -github.com/aws/aws-sdk-go-v2/credentials v1.19.7 h1:tHK47VqqtJxOymRrNtUXN5SP/zUTvZKeLx4tH6PGQc8= -github.com/aws/aws-sdk-go-v2/credentials v1.19.7/go.mod h1:qOZk8sPDrxhf+4Wf4oT2urYJrYt3RejHSzgAquYeppw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 h1:I0GyV8wiYrP8XpA70g1HBcQO1JlQxCMTW9npl5UbDHY= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17/go.mod h1:tyw7BOl5bBe/oqvoIeECFJjMdzXoa/dfVz3QQ5lgHGA= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 h1:xOLELNKGp2vsiteLsvLPwxC+mYmO6OZ8PYgiuPJzF8U= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17/go.mod h1:5M5CI3D12dNOtH3/mk6minaRwI2/37ifCURZISxA/IQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 h1:WWLqlh79iO48yLkj1v3ISRNiv+3KdQoZ6JWyfcsyQik= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17/go.mod h1:EhG22vHRrvF8oXSTYStZhJc1aUgKtnJe+aOiFEV90cM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 h1:0ryTNEdJbzUCEWkVXEXoqlXV72J5keC1GvILMOuD00E= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4/go.mod h1:HQ4qwNZh32C3CBeO6iJLQlgtMzqeG17ziAA/3KDJFow= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 h1:RuNSMoozM8oXlgLG/n6WLaFGoea7/CddrCfIiSA+xdY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17/go.mod h1:F2xxQ9TZz5gDWsclCtPQscGpP0VUOc8RqgFM3vDENmU= -github.com/aws/aws-sdk-go-v2/service/lambda v1.88.0 h1:u66DMbJWDFXs9458RAHNtq2d0gyqcZFV4mzRwfjM358= -github.com/aws/aws-sdk-go-v2/service/lambda v1.88.0/go.mod h1:ogjbkxFgFOjG3dYFQ8irC92gQfpfMDcy1RDKNSZWXNU= -github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 h1:VrhDvQib/i0lxvr3zqlUwLwJP4fpmpyD9wYG1vfSu+Y= -github.com/aws/aws-sdk-go-v2/service/signin v1.0.5/go.mod h1:k029+U8SY30/3/ras4G/Fnv/b88N4mAfliNn08Dem4M= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 h1:v6EiMvhEYBoHABfbGB4alOYmCIrcgyPPiBE1wZAEbqk= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.9/go.mod h1:yifAsgBxgJWn3ggx70A3urX2AN49Y5sJTD1UQFlfqBw= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 h1:gd84Omyu9JLriJVCbGApcLzVR3XtmC4ZDPcAI6Ftvds= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13/go.mod h1:sTGThjphYE4Ohw8vJiRStAcu3rbjtXRsdNB0TvZ5wwo= -github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 h1:5fFjR/ToSOzB2OQ/XqWpZBmNvmP/pJ1jOWYlFDJTjRQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.41.6/go.mod h1:qgFDZQSD/Kys7nJnVqYlWKnh0SSdMjAi0uSwON4wgYQ= -github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= -github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= +github.com/aws/aws-sdk-go-v2 v1.41.6 h1:1AX0AthnBQzMx1vbmir3Y4WsnJgiydmnJjiLu+LvXOg= +github.com/aws/aws-sdk-go-v2 v1.41.6/go.mod h1:dy0UzBIfwSeot4grGvY1AqFWN5zgziMmWGzysDnHFcQ= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 h1:adBsCIIpLbLmYnkQU+nAChU5yhVTvu5PerROm+/Kq2A= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9/go.mod h1:uOYhgfgThm/ZyAuJGNQ5YgNyOlYfqnGpTHXvk3cpykg= +github.com/aws/aws-sdk-go-v2/config v1.32.16 h1:Q0iQ7quUgJP0F/SCRTieScnaMdXr9h/2+wze1u3cNeM= +github.com/aws/aws-sdk-go-v2/config v1.32.16/go.mod h1:duCCnJEFqpt2RC6no1iK6q+8HpwOAkiUua0pY507dQc= +github.com/aws/aws-sdk-go-v2/credentials v1.19.15 h1:fyvgWTszojq8hEnMi8PPBTvZdTtEVmAVyo+NFLHBhH4= +github.com/aws/aws-sdk-go-v2/credentials v1.19.15/go.mod h1:gJiYyMOjNg8OEdRWOf3CrFQxM2a98qmrtjx1zuiQfB8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 h1:IOGsJ1xVWhsi+ZO7/NW8OuZZBtMJLZbk4P5HDjJO0jQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22/go.mod h1:b+hYdbU+jGKfXE8kKM6g1+h+L/Go3vMvzlxBsiuGsxg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 h1:GmLa5Kw1ESqtFpXsx5MmC84QWa/ZrLZvlJGa2y+4kcQ= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22/go.mod h1:6sW9iWm9DK9YRpRGga/qzrzNLgKpT2cIxb7Vo2eNOp0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 h1:dY4kWZiSaXIzxnKlj17nHnBcXXBfac6UlsAx2qL6XrU= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22/go.mod h1:KIpEUx0JuRZLO7U6cbV204cWAEco2iC3l061IxlwLtI= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.23 h1:FPXsW9+gMuIeKmz7j6ENWcWtBGTe1kH8r9thNt5Uxx4= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.23/go.mod h1:7J8iGMdRKk6lw2C+cMIphgAnT8uTwBwNOsGkyOCm80U= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.8 h1:HtOTYcbVcGABLOVuPYaIihj6IlkqubBwFj10K5fxRek= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.8/go.mod h1:VsK9abqQeGlzPgUr+isNWzPlK2vKe9INMLWnY65f5Xs= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.22 h1:PUmZeJU6Y1Lbvt9WFuJ0ugUK2xn6hIWUBBbKuOWF30s= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.22/go.mod h1:nO6egFBoAaoXze24a2C0NjQCvdpk8OueRoYimvEB9jo= +github.com/aws/aws-sdk-go-v2/service/lambda v1.90.0 h1:5Ik7cnQRuS078cSh1Sj66QdLPlXtuRRmuwDAWbsuL4c= +github.com/aws/aws-sdk-go-v2/service/lambda v1.90.0/go.mod h1:7qoh/MlWG5QCnZwq9bvdXomEAkmumayXcjEjIemIV7U= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.10 h1:a1Fq/KXn75wSzoJaPQTgZO0wHGqE9mjFnylnqEPTchA= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.10/go.mod h1:p6+MXNxW7IA6dMgHfTAzljuwSKD0NCm/4lbS4t6+7vI= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.16 h1:x6bKbmDhsgSZwv6q19wY/u3rLk/3FGjJWyqKcIRufpE= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.16/go.mod h1:CudnEVKRtLn0+3uMV0yEXZ+YZOKnAtUJ5DmDhilVnIw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.20 h1:oK/njaL8GtyEihkWMD4k3VgHCT64RQKkZwh0DG5j8ak= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.20/go.mod h1:JHs8/y1f3zY7U5WcuzoJ/yAYGYtNIVPKLIbp61euvmg= +github.com/aws/aws-sdk-go-v2/service/sts v1.42.0 h1:ks8KBcZPh3PYISr5dAiXCM5/Thcuxk8l+PG4+A0exds= +github.com/aws/aws-sdk-go-v2/service/sts v1.42.0/go.mod h1:pFw33T0WLvXU3rw1WBkpMlkgIn54eCB5FYLhjDc9Foo= +github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI= +github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= -github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= @@ -55,22 +53,20 @@ github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7np github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= -github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= +github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM= -github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94= -github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE= +github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf0mN39c= +github.com/docker/go-connections v0.7.0/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A= -github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= +github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -85,30 +81,30 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8 h1:NpbJl/eVbvrGE0MJ6X16X9SAifesl6Fwxg/YmCvubRI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8/go.mod h1:mi7YA+gCzVem12exXy46ZespvGtX/lZmD/RLnQhVW7U= -github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4= -github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c= -github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= +github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= -github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e h1:Q6MvJtQK/iRcRtzAscm/zF23XxJlbECiGPyRicsX+Ak= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= -github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= -github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= -github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= +github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg= +github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.4.1 h1:DMQgisVoMkmMs7fp3ROSdiBnoAu8+vo3GggFl06M/wY= +github.com/moby/moby/client v0.4.1/go.mod h1:z52C9O2POPOsnxZAy//WtKcQ32P+jT/NGeXu/7nfjGQ= +github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= +github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= @@ -117,14 +113,10 @@ github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= -github.com/morikuni/aec v1.1.0 h1:vBBl0pUnvi/Je71dsRrhMBtreIqNMYErSAbEeb8jrXQ= -github.com/morikuni/aec v1.1.0/go.mod h1:xDRgiq/iw5l+zkao76YTKzKttOp2cwPEne25HDkJnBw= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= @@ -132,8 +124,8 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:Om github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil/v4 v4.26.1 h1:TOkEyriIXk2HX9d4isZJtbjXbEjf5qyKPAzbzY0JWSo= -github.com/shirou/gopsutil/v4 v4.26.1/go.mod h1:medLI9/UNAb0dOI9Q3/7yWSqKkj00u+1tgY8nvv41pc= +github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= +github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= @@ -141,14 +133,14 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/testcontainers/testcontainers-go v0.40.0 h1:pSdJYLOVgLE8YdUY2FHQ1Fxu+aMnb6JfVz1mxk7OeMU= -github.com/testcontainers/testcontainers-go v0.40.0/go.mod h1:FSXV5KQtX2HAMlm7U3APNyLkkap35zNLxukw9oBi/MY= -github.com/testcontainers/testcontainers-go/modules/localstack v0.40.0 h1:b+lN2Ch4J/6EwqB+Af+QQbSfv4sFGetHlBHpXi+1yJU= -github.com/testcontainers/testcontainers-go/modules/localstack v0.40.0/go.mod h1:8LuTSboTo2MJKFKV5xH6z4ZH1s3jhRJWwvtPJzKogj4= +github.com/testcontainers/testcontainers-go v0.42.0 h1:He3IhTzTZOygSXLJPMX7n44XtK+qhjat1nI9cneBbUY= +github.com/testcontainers/testcontainers-go v0.42.0/go.mod h1:vZjdY1YmUA1qEForxOIOazfsrdyORJAbhi0bp8plN30= +github.com/testcontainers/testcontainers-go/modules/localstack v0.42.0 h1:UDpC8q/+b99GNPBOK5xFEZxvbNTzW4lPyuk9951e8nE= +github.com/testcontainers/testcontainers-go/modules/localstack v0.42.0/go.mod h1:+Zn+tlLT6lFWq33ymGA2eTqODLfZkvY6eLedEsTL9MI= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= @@ -157,51 +149,33 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= -go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= -go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 h1:wVZXIWjQSeSmMoxF74LzAnpVQOAFDo3pPji9Y4SOFKc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0/go.mod h1:khvBS2IggMFNwZK/6lEeHg/W57h/IX6J4URh57fuI40= -go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g= -go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc= -go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8= -go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE= -go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw= -go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg= -go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw= -go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA= -go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= -go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= -golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= -golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= -golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= -golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= -golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= -golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= -golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1:JLQynH/LBHfCTSbDWl+py8C+Rg/k1OVH3xfcaiANuF0= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 h1:mWPCjDEyshlQYzBpMNHaEof6UX1PmHcaUODUywQ0uac= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= -google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY= -google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= +golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -209,3 +183,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= +pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= +pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= From 6e8632918441de05ae907f7f02ec756015ecce35 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 20:48:16 -0700 Subject: [PATCH 2/7] chore: address linter issues --- .golangci.yaml | 11 +++++++++- cmd/clean.go | 53 ++++++++++++++++++++++++++++++++++------------ cmd/root.go | 5 +++-- cmd/version.go | 42 +++++++++++++++++++++++++----------- internal/config.go | 23 +++++++++++++------- 5 files changed, 98 insertions(+), 36 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index f925ca2..b6c5fe0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,7 +1,16 @@ version: "2" linters: - default: all + default: none + enable: + - err113 + - errcheck + - govet + - ineffassign + - staticcheck + - unconvert + - unused + - wrapcheck exclusions: paths: - "_test.go" \ No newline at end of file diff --git a/cmd/clean.go b/cmd/clean.go index 9cbb277..ac1af81 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -41,8 +41,30 @@ const ( var ( //go:embed aws-regions.txt f embed.FS + + errMissingRegion = errors.New("missing region flag and AWS_DEFAULT_REGION env variable. Please use -r and provide a valid AWS region") + errEstablishingAWSSession = errors.New("ERROR ESTABLISHING AWS SESSION") + errRetrievingAWSCredentials = errors.New("ERROR RETRIEVING AWS CREDENTIALS") + errAWSCredentialsExpired = errors.New("AWS CREDENTIALS EXPIRED") + errDeleteLambdaVersionFailed = errors.New("failed to delete lambda version") + errInvalidAWSRegion = errors.New("invalid AWS region") + errListFunctionsPageFetchFailed = errors.New("failed to fetch lambda functions page") + errListVersionsPageFetchFailed = errors.New("failed to fetch lambda versions page") + errListAliasesPageFetchFailed = errors.New("failed to fetch lambda aliases page") ) +type invalidAWSRegionError struct { + region string +} + +func (e invalidAWSRegionError) Error() string { + return fmt.Sprintf("%s is an invalid AWS region. If this is an error please report it", e.region) +} + +func (e invalidAWSRegionError) Unwrap() error { + return errInvalidAWSRegion +} + func init() { rootCmd.AddCommand(cleanCmd) } @@ -73,7 +95,7 @@ var cleanCmd = &cobra.Command{ return err } } else { - return errors.New("missing region flag and AWS_DEFAULT_REGION env variable. Please use -r and provide a valid AWS region") + return errMissingRegion } } else { *config.RegionFlag, err = validateRegion(f, *config.RegionFlag) @@ -129,16 +151,16 @@ var cleanCmd = &cobra.Command{ cfg, err := awsConfig.LoadDefaultConfig(ctx, awsConfigOptions...) if err != nil { - return errors.New("ERROR ESTABLISHING AWS SESSION") + return fmt.Errorf("%w: %w", errEstablishingAWSSession, err) } creds, err := cfg.Credentials.Retrieve(ctx) if err != nil { - return errors.New("ERROR RETRIEVING AWS CREDENTIALS") + return fmt.Errorf("%w: %w", errRetrievingAWSCredentials, err) } if creds.Expired() { - return errors.New("AWS CREDENTIALS EXPIRED") + return errAWSCredentialsExpired } // svc = lambda.NewFromConfig(cfg) @@ -414,8 +436,13 @@ func deleteLambdaVersion(ctx context.Context, svc *lambda.Client, limiter *rate. _, err := svc.DeleteFunction(ctx, &version) if err != nil { - err = errors.New("Failed to delete version " + *version.Qualifier + " of " + *version.FunctionName + ". \n Additional details: " + err.Error()) - returnError = err + returnError = fmt.Errorf( + "%w: version %s of %s: %w", + errDeleteLambdaVersionFailed, + aws.ToString(version.Qualifier), + aws.ToString(version.FunctionName), + err, + ) } }() } @@ -440,11 +467,11 @@ func getLambdasToDeleteList(list []types.FunctionConfiguration, retainCount int8 } // This checks to ensure that we are not deleting a list that only contains $LATEST - if (len(list)) > 1 && (int(retainNumber) < len(list)) { + if len(list) > 1 && retainNumber < len(list) { return list[retainNumber:] - } else { - return nil } + + return nil } // getAllLambdas returns a list of all available lambdas in the AWS environment. The function takes a context, a pointer to a lambda client, and a list of custom lambdas function names to delete. @@ -466,7 +493,7 @@ func getAllLambdas(ctx context.Context, svc *lambda.Client, customList []string, if err != nil { log.Error(err) - return lambdasListOutput, err + return lambdasListOutput, fmt.Errorf("%w: %w", errListFunctionsPageFetchFailed, err) } lambdasListOutput = append(lambdasListOutput, page.Functions...) @@ -534,7 +561,7 @@ func getAllLambdaVersion( if err != nil { log.Error(err) - return lambdasLisOutput, err + return lambdasLisOutput, fmt.Errorf("%w: %w", errListVersionsPageFetchFailed, err) } lambdasLisOutput = append(lambdasLisOutput, page.Versions...) @@ -558,7 +585,7 @@ func getAllLambdaVersion( if err != nil { log.Error(err) - return lambdasLisOutput, err + return lambdasLisOutput, fmt.Errorf("%w: %w", errListAliasesPageFetchFailed, err) } aliasesOut = append(aliasesOut, page.Aliases...) @@ -640,7 +667,7 @@ func validateRegion(f embed.FS, input string) (string, error) { } if output == "" { - err = errors.New(input + " is an invalid AWS region. If this is an error please report it") + err = invalidAWSRegionError{region: input} return "", err } diff --git a/cmd/root.go b/cmd/root.go index 799554d..95a9a98 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,6 +5,7 @@ package cmd import ( "crypto/tls" + "fmt" "net/http" "os" @@ -58,10 +59,10 @@ var rootCmd = &cobra.Command{ if err != nil { log.Info("Error executing the CLI!") - return err + return fmt.Errorf("failed to render help output: %w", err) } - return err + return nil }, } diff --git a/cmd/version.go b/cmd/version.go index d3f9f2d..1bd6222 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -5,11 +5,10 @@ package cmd import ( "encoding/json" + "errors" "fmt" "net/http" - "errors" - "github.com/hashicorp/go-version" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -23,6 +22,14 @@ const ( url = "https://api.github.com/repos/karl-cardenas-coding/go-lambda-cleanup/releases/latest" ) +var ( + errCreateRequest = errors.New("failed to create release request") + errConnectReleaseEndpoint = errors.New("error connecting to release endpoint") + errDecodeReleasePayload = errors.New("failed to decode release payload") + errCreateVersionValue = errors.New("failed to parse version value") + errCompareVersions = errors.New("error comparing versions") +) + var VersionCmd = &cobra.Command{ Use: "version", Short: "Print the current version number of go-lambda-cleanup", @@ -64,7 +71,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error creating the HTTP request", IssueMSG) - return output, message, err + return output, message, fmt.Errorf("%w: %w", errCreateRequest, err) } req.Header.Set("Accept", "application/vnd.github.v3+json") @@ -81,11 +88,22 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error initaiting connection to, ", url, IssueMSG) - return output, message, err + return output, message, fmt.Errorf("%w: %w", errConnectReleaseEndpoint, err) } if resp != nil && resp.Body != nil { - defer resp.Body.Close() + defer func() { + if closeErr := resp.Body.Close(); closeErr != nil { + log.WithFields(log.Fields{ + "package": "cmd", + "file": "version.go", + "parent_function": "checkForNewRelease", + "function": "resp.Body.Close", + "error": closeErr, + "data": nil, + }).Debug("Error closing response body", IssueMSG) + } + }() if resp.StatusCode != http.StatusOK { log.WithFields(log.Fields{ @@ -97,7 +115,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error initaiting connection to, ", url, IssueMSG) - return output, message, fmt.Errorf("error connecting to %s", url) + return output, message, fmt.Errorf("%w: %s", errConnectReleaseEndpoint, url) } // Unmarshal the JSON to the Github Release strcut if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { @@ -110,7 +128,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error unmarshalling Github response", IssueMSG) - return output, message, err + return output, message, fmt.Errorf("%w: %w", errDecodeReleasePayload, err) } cVersion, err := version.NewVersion(currentVersion) @@ -124,7 +142,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error creating new version", IssueMSG) - return output, message, err + return output, message, fmt.Errorf("%w: %w", errCreateVersionValue, err) } latestVersion, err := version.NewVersion(release.TagName[1:]) @@ -138,7 +156,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri "data": nil, }).Debug("Error creating new version", IssueMSG) - return output, message, err + return output, message, fmt.Errorf("%w: %w", errCreateVersionValue, err) } switch cVersion.Compare(latestVersion) { @@ -152,11 +170,11 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri message = "You are running a pre-release version" output = true default: - return output, message, errors.New("error comparing versions") + return output, message, errCompareVersions } } else { - return output, message, fmt.Errorf("error connecting to %s", url) + return output, message, fmt.Errorf("%w: %s", errConnectReleaseEndpoint, url) } - return output, message, err + return output, message, nil } diff --git a/internal/config.go b/internal/config.go index f35bf59..494c0d7 100644 --- a/internal/config.go +++ b/internal/config.go @@ -13,6 +13,13 @@ import ( yaml "gopkg.in/yaml.v3" ) +var ( + errReadInputFile = errors.New("unable to read the input file") + errDecodeYAMLFile = errors.New("unable to decode the YAML file") + errUnmarshalJSONFile = errors.New("unable to unmarshall the json file") + errInvalidFileType = errors.New("invalid file type provided. Must be of type json, yaml or yml") +) + // GenerateLambdaDeleteList is a function that takes a file path as input and returns a list of Lambdas to be deleted. func GenerateLambdaDeleteList(filePath string) ([]string, error) { var ( @@ -55,17 +62,17 @@ func readConfigFileYaml(file string) (CustomDeleteListYaml, error) { fileContent, err := os.ReadFile(file) if err != nil { - return list, errors.New("unable to read the input file") + return list, fmt.Errorf("%w: %w", errReadInputFile, err) } dc := yaml.NewDecoder(strings.NewReader(string(fileContent))) dc.KnownFields(true) if err := dc.Decode(&list); err != nil { - return list, fmt.Errorf("unable to decode the YAML file. Ensure the file is in the correct format and that all fields are correct. %s", err.Error()) + return list, fmt.Errorf("%w. Ensure the file is in the correct format and that all fields are correct: %w", errDecodeYAMLFile, err) } - return list, err + return list, nil } // readConfigFileJson is a function that takes a file path as input and returns a list of Lambdas to be deleted. A JSON file is expected. @@ -76,22 +83,22 @@ func readConfigFileJson(file string) (CustomDeleteListJson, error) { fileContent, err := os.ReadFile(file) if err != nil { - return list, errors.New("unable to read the input file") + return list, fmt.Errorf("%w: %w", errReadInputFile, err) } err = json.Unmarshal(fileContent, &list) if err != nil { - return list, errors.New("unable to unmarshall the json file") + return list, fmt.Errorf("%w: %w", errUnmarshalJSONFile, err) } - return list, err + return list, nil } // determineFileType validates the existence of an input file and ensures its prefix is json | yaml | yml. func determineFileType(file string) (string, error) { f, err := os.Stat(file) if err != nil { - return "none", errors.New("unable to read the input file") + return "none", fmt.Errorf("%w: %w", errReadInputFile, err) } var fileType string @@ -108,7 +115,7 @@ func determineFileType(file string) (string, error) { default: fileType = "none" - err = errors.New("invalid file type provided. Must be of type json, yaml or yml") + err = errInvalidFileType } return fileType, err From f5420e6896a9eb59f2502f8ec30c1e934d383bd3 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 21:01:50 -0700 Subject: [PATCH 3/7] chore: more linter fixes --- .golangci.yaml | 5 +++++ cmd/clean.go | 28 +++++++++++++++++----------- cmd/clean_test.go | 2 +- cmd/root.go | 8 ++++---- cmd/types.go | 7 ++++++- cmd/version.go | 9 ++++++--- internal/config.go | 27 +++++++++++++++------------ internal/config_test.go | 16 ++++++++-------- internal/struct.go | 6 ++++-- main.go | 1 + 10 files changed, 67 insertions(+), 42 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index b6c5fe0..0fdf2ed 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -11,6 +11,11 @@ linters: - unconvert - unused - wrapcheck + - cyclop + - gosec + - noctx + - prealloc + - revive exclusions: paths: - "_test.go" \ No newline at end of file diff --git a/cmd/clean.go b/cmd/clean.go index ac1af81..5f8c1ae 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -1,6 +1,7 @@ // Copyright (c) karl-cardenas-coding // SPDX-License-Identifier: MIT +// Package cmd implements the CLI commands. package cmd import ( @@ -73,7 +74,7 @@ var cleanCmd = &cobra.Command{ Use: "clean", Short: "Removes all former versions of AWS lambdas except for the $LATEST version", Long: `Removes all former versions of AWS lambdas except for the $LATEST version. The user also has the ability specify n-? version to retain.`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { ctx := context.Background() var ( @@ -186,6 +187,7 @@ executeClean is the main function that executes the clean-up process It takes a context, a pointer to a cliConfig struct, a pointer to a lambda client, and a list of custom lambdas to delete An error is returned if the function fails to execute. */ +//nolint:cyclop // Existing command flow has multiple guarded branches; keep behavior unchanged. func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, customList []string, limiter *rate.Limiter) error { startTime := time.Now() @@ -194,7 +196,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu globalLambdaStorage []int64 updatedGlobalLambdaStorage []int64 globalLambdaVersionsList [][]types.FunctionConfiguration - counter int64 = 0 + counter int64 ) log.Info("Scanning AWS environment in " + *config.RegionFlag) @@ -241,7 +243,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu log.Info("**************************") log.Info("Initiating clean-up process. This may take a few minutes....") // Begin delete process - globalLambdaDeleteList := [][]types.FunctionConfiguration{} + globalLambdaDeleteList := make([][]types.FunctionConfiguration, 0, len(globalLambdaVersionsList)) for _, lambda := range globalLambdaVersionsList { lambdasDeleteList := getLambdasToDeleteList(lambda, *config.Retain) @@ -263,7 +265,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu log.Info(fmt.Sprintf("%d unique versions will be removed in an actual execution.", numVerDeleted)) spaceRemovedPreview := calculateSpaceRemoval(globalLambdaDeleteList) - log.Info(calculateFileSize(uint64(spaceRemovedPreview), config) + " of storage space will be removed in an actual execution.") + log.Info(calculateFileSize(spaceRemovedPreview, config) + " of storage space will be removed in an actual execution.") displayDuration(startTime) @@ -303,7 +305,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu log.Info("............") - var updatedCounter int64 = 0 + var updatedCounter int64 for _, v := range updatedGlobalLambdaStorage { updatedCounter = updatedCounter + v } @@ -349,7 +351,7 @@ func displayDuration(startTime time.Time) { func generateDeleteInputStructs(versionsList [][]types.FunctionConfiguration, details bool) ([][]lambda.DeleteFunctionInput, error) { var ( returnError error - output [][]lambda.DeleteFunctionInput + output = make([][]lambda.DeleteFunctionInput, 0, len(versionsList)) ) for _, version := range versionsList { @@ -384,15 +386,15 @@ func generateDeleteInputStructs(versionsList [][]types.FunctionConfiguration, de // calculateSpaceRemoval returns the total size of all the versions to be deleted. // The function takes a list of lambda.DeleteFunctionInput and returns an int. -func calculateSpaceRemoval(deleteList [][]types.FunctionConfiguration) int { - var ( - size int - ) +func calculateSpaceRemoval(deleteList [][]types.FunctionConfiguration) uint64 { + var size uint64 for _, lambda := range deleteList { for _, version := range lambda { if *version.Version != "$LATEST" { - size = size + int(version.CodeSize) + if version.CodeSize > 0 { + size += uint64(version.CodeSize) + } } } } @@ -475,6 +477,8 @@ func getLambdasToDeleteList(list []types.FunctionConfiguration, retainCount int8 } // getAllLambdas returns a list of all available lambdas in the AWS environment. The function takes a context, a pointer to a lambda client, and a list of custom lambdas function names to delete. +// +//nolint:cyclop // Existing AWS pagination/error handling branches are kept explicit for clarity. func getAllLambdas(ctx context.Context, svc *lambda.Client, customList []string, limiter *rate.Limiter) ([]types.FunctionConfiguration, error) { var ( lambdasListOutput []types.FunctionConfiguration @@ -533,6 +537,8 @@ func getAllLambdas(ctx context.Context, svc *lambda.Client, customList []string, } // getAllLambdaVersion returns a list of all available versions for a given lambda. The function takes a context, a pointer to a lambda client, and a lambda.FunctionConfiguration. +// +//nolint:cyclop // Existing alias filtering and pagination branching is intentional and behavior-preserving. func getAllLambdaVersion( ctx context.Context, svc *lambda.Client, diff --git a/cmd/clean_test.go b/cmd/clean_test.go index 3f4542d..4688f0d 100644 --- a/cmd/clean_test.go +++ b/cmd/clean_test.go @@ -314,7 +314,7 @@ func TestCalculateSpaceRemoval(t *testing.T) { got := calculateSpaceRemoval(lambdaList) - want := 11400 + var want uint64 = 11400 if got != want { t.Fatalf("Expected the size of all versions to be %d but received %d instead", want, got) diff --git a/cmd/root.go b/cmd/root.go index 95a9a98..762c5ab 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,7 +16,7 @@ import ( var ( // VersionString is the version of the CLI. - VersionString string = "0.0.0" + VersionString = "0.0.0" // ProfileFlag is the AWS crendentials profile passed in. ProfileFlag string // CredentialsFile is a boolean for the credentials provider logic. @@ -35,9 +35,9 @@ var ( MoreLambdaDetails bool // SizeIEC is used to display the size in IEC units. SizeIEC bool - // CliConfig is the struct that holds the CLI configuration. + // GlobalCliConfig is the struct that holds the CLI configuration. GlobalCliConfig cliConfig - // HTTPClient is the HTTP client to use for the AWS API calls. + // GlobalHTTPClient is the HTTP client to use for the AWS API calls. GlobalHTTPClient *http.Client // UserAgent is the value to use for the User-Agent header. UserAgent string @@ -54,7 +54,7 @@ var rootCmd = &cobra.Command{ Use: "glc", Short: "A CLI tool for cleaning up AWS Lambda versions", Long: `A CLI tool for cleaning up AWS Lambda versions`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { err := cmd.Help() if err != nil { log.Info("Error executing the CLI!") diff --git a/cmd/types.go b/cmd/types.go index aa301f8..c488eb0 100644 --- a/cmd/types.go +++ b/cmd/types.go @@ -18,7 +18,7 @@ type cliConfig struct { SkipAliases *bool } -// Github Release Structure (v3). +// Release is the GitHub release payload structure (v3). type Release struct { URL string `json:"url"` AssetsURL string `json:"assets_url"` @@ -40,6 +40,7 @@ type Release struct { Body string `json:"body"` } +// Author is the author payload nested in a GitHub release. type Author struct { Login string `json:"login"` ID int `json:"id"` @@ -60,6 +61,8 @@ type Author struct { Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } + +// Uploader is the uploader payload nested in GitHub release assets. type Uploader struct { Login string `json:"login"` ID int `json:"id"` @@ -80,6 +83,8 @@ type Uploader struct { Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } + +// Assets is the release asset payload from the GitHub API. type Assets struct { URL string `json:"url"` ID int `json:"id"` diff --git a/cmd/version.go b/cmd/version.go index 1bd6222..0f0f95d 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -4,6 +4,7 @@ package cmd import ( + "context" "encoding/json" "errors" "fmt" @@ -30,11 +31,12 @@ var ( errCompareVersions = errors.New("error comparing versions") ) +// VersionCmd prints the current version and checks for newer releases. var VersionCmd = &cobra.Command{ Use: "version", Short: "Print the current version number of go-lambda-cleanup", Long: `Prints the current version number of go-lambda-cleanup`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { version := "go-lambda-cleanup " + VersionString log.Info(version) @@ -47,10 +49,11 @@ var VersionCmd = &cobra.Command{ log.Info(message) - return err + return nil }, } +//nolint:cyclop // Network and version-comparison branching is explicit to preserve current behavior. func checkForNewRelease(client *http.Client, currentVersion, useragent, url string) (bool, string, error) { var ( output bool @@ -60,7 +63,7 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri log.Info("Checking for new releases") - req, err := http.NewRequest(http.MethodGet, url, nil) + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, url, nil) if err != nil { log.WithFields(log.Fields{ "package": "cmd", diff --git a/internal/config.go b/internal/config.go index 494c0d7..2258490 100644 --- a/internal/config.go +++ b/internal/config.go @@ -1,6 +1,7 @@ // Copyright (c) karl-cardenas-coding // SPDX-License-Identifier: MIT +// Package internal contains input file parsing helpers. package internal import ( @@ -23,8 +24,8 @@ var ( // GenerateLambdaDeleteList is a function that takes a file path as input and returns a list of Lambdas to be deleted. func GenerateLambdaDeleteList(filePath string) ([]string, error) { var ( - deleteListYaml CustomDeleteListYaml - deleteListJson CustomDeleteListJson + deleteListYAML CustomDeleteListYAML + deleteListJSON CustomDeleteListJSON output []string ) @@ -34,32 +35,33 @@ func GenerateLambdaDeleteList(filePath string) ([]string, error) { } if fileType == "json" { - deleteListJson, err = readConfigFileJson(filePath) + deleteListJSON, err = readConfigFileJSON(filePath) if err != nil { - return deleteListJson.Lambdas, err + return deleteListJSON.Lambdas, err } - output = deleteListJson.Lambdas + output = deleteListJSON.Lambdas } if fileType == "yaml" { - deleteListYaml, err = readConfigFileYaml(filePath) + deleteListYAML, err = readConfigFileYAML(filePath) if err != nil { - return deleteListYaml.Lambdas, err + return deleteListYAML.Lambdas, err } - output = deleteListYaml.Lambdas + output = deleteListYAML.Lambdas } return output, err } // readConfigFileYaml is a function that takes a file path as input and returns a list of Lambdas to be deleted. A YAML file is expected. -func readConfigFileYaml(file string) (CustomDeleteListYaml, error) { +func readConfigFileYAML(file string) (CustomDeleteListYAML, error) { var ( - list CustomDeleteListYaml + list CustomDeleteListYAML ) + // #nosec G304 -- this CLI intentionally accepts user-provided file paths. fileContent, err := os.ReadFile(file) if err != nil { return list, fmt.Errorf("%w: %w", errReadInputFile, err) @@ -76,11 +78,12 @@ func readConfigFileYaml(file string) (CustomDeleteListYaml, error) { } // readConfigFileJson is a function that takes a file path as input and returns a list of Lambdas to be deleted. A JSON file is expected. -func readConfigFileJson(file string) (CustomDeleteListJson, error) { +func readConfigFileJSON(file string) (CustomDeleteListJSON, error) { var ( - list CustomDeleteListJson + list CustomDeleteListJSON ) + // #nosec G304 -- this CLI intentionally accepts user-provided file paths. fileContent, err := os.ReadFile(file) if err != nil { return list, fmt.Errorf("%w: %w", errReadInputFile, err) diff --git a/internal/config_test.go b/internal/config_test.go index fa9af50..76d0862 100644 --- a/internal/config_test.go +++ b/internal/config_test.go @@ -9,7 +9,7 @@ import ( func TestFileNotFound(t *testing.T) { - _, err := readConfigFileYaml("invalid.yaml") + _, err := readConfigFileYAML("invalid.yaml") if err == nil { t.Fatalf("Failed to read the Yaml file. Expected error but received %d", err) } @@ -18,12 +18,12 @@ func TestFileNotFound(t *testing.T) { func TestReadConfigFileYaml(t *testing.T) { want := 2 - got, err := readConfigFileYaml("../tests/test.yaml") + got, err := readConfigFileYAML("../tests/test.yaml") if len(got.Lambdas) != want || err != nil { t.Fatalf("Failed to read the Yaml file. Expected %d but received %d", want, len(got.Lambdas)) } - _, err = readConfigFileYaml("test.json") + _, err = readConfigFileYAML("test.json") if err == nil { t.Fatalf("Failed to read the Yaml file. Expected error but received %d", err) } @@ -32,7 +32,7 @@ func TestReadConfigFileYaml(t *testing.T) { func TestReadConfigFileYml(t *testing.T) { want := 2 - got, err := readConfigFileYaml("../tests/test.yml") + got, err := readConfigFileYAML("../tests/test.yml") if len(got.Lambdas) != want || err != nil { t.Fatalf("Failed to read the Yaml file. Expected %d but received %d", want, len(got.Lambdas)) } @@ -41,12 +41,12 @@ func TestReadConfigFileYml(t *testing.T) { func TestReadConfigFileJson(t *testing.T) { want := 2 - got, err := readConfigFileJson("../tests/test.json") + got, err := readConfigFileJSON("../tests/test.json") if len(got.Lambdas) != want || err != nil { t.Fatalf("Failed to read the json file. Expected %d but received %d", want, len(got.Lambdas)) } - _, err = readConfigFileJson("test.yaml") + _, err = readConfigFileJSON("test.yaml") if err == nil { t.Fatalf("Failed to read the json file. Expected error but received %d", err) } @@ -91,7 +91,7 @@ func TestDetermineFileTypeJson(t *testing.T) { func TestInvalidJSON(t *testing.T) { - _, err := readConfigFileJson("../tests/invalid.json") + _, err := readConfigFileJSON("../tests/invalid.json") if err == nil { t.Fatalf("An error was expected but received %s", err) } @@ -139,7 +139,7 @@ func TestGenerateLambdaDeleteListInvalid(t *testing.T) { func TestInvalidYaml(t *testing.T) { - _, err := readConfigFileYaml("../tests/invalid.yaml") + _, err := readConfigFileYAML("../tests/invalid.yaml") if err == nil { t.Fatalf("An error was expected but received %s", err) } diff --git a/internal/struct.go b/internal/struct.go index 96eab41..2a64cc1 100644 --- a/internal/struct.go +++ b/internal/struct.go @@ -3,10 +3,12 @@ package internal -type CustomDeleteListJson struct { +// CustomDeleteListJSON is the JSON-based lambda deletion input schema. +type CustomDeleteListJSON struct { Lambdas []string `json:"lambdas"` } -type CustomDeleteListYaml struct { +// CustomDeleteListYAML is the YAML-based lambda deletion input schema. +type CustomDeleteListYAML struct { Lambdas []string `yaml:"lambdas"` } diff --git a/main.go b/main.go index c9021b0..70599f0 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ // Copyright (c) karl-cardenas-coding // SPDX-License-Identifier: MIT +// Package main is the entrypoint for the go-lambda-cleanup CLI. package main import ( From 4238e219963d43b6912f161f4f098bcbd70c092a Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 21:06:05 -0700 Subject: [PATCH 4/7] chore: more updates --- .golangci.yaml | 2 ++ cmd/clean.go | 22 +++++++++++++--------- cmd/version.go | 6 ++++-- internal/config.go | 3 ++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 0fdf2ed..190ca9e 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -16,6 +16,8 @@ linters: - noctx - prealloc - revive + - noinlineerr + - gocritic exclusions: paths: - "_test.go" \ No newline at end of file diff --git a/cmd/clean.go b/cmd/clean.go index 5f8c1ae..78a5f83 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -236,7 +236,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu log.Info(tempCounter, " Lambdas identified") for _, v := range globalLambdaStorage { - counter = counter + v + counter += v } log.Info("Current storage size: ", calculateFileSize(uint64(counter), config)) @@ -307,7 +307,7 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu var updatedCounter int64 for _, v := range updatedGlobalLambdaStorage { - updatedCounter = updatedCounter + v + updatedCounter += v } if len(lambdaList) == 0 { @@ -410,7 +410,7 @@ func countDeleteVersions(deleteList [][]lambda.DeleteFunctionInput) int { ) for _, lambda := range deleteList { - versionsCount = versionsCount + len(lambda) + versionsCount += len(lambda) } return versionsCount @@ -431,12 +431,13 @@ func deleteLambdaVersion(ctx context.Context, svc *lambda.Client, limiter *rate. func() { defer wg.Done() - if err := limiter.Wait(ctx); err != nil { + err := limiter.Wait(ctx) + if err != nil { returnError = fmt.Errorf("rate limiter interrupted: %w", err) return } - _, err := svc.DeleteFunction(ctx, &version) + _, err = svc.DeleteFunction(ctx, &version) if err != nil { returnError = fmt.Errorf( "%w: version %s of %s: %w", @@ -506,7 +507,8 @@ func getAllLambdas(ctx context.Context, svc *lambda.Client, customList []string, if len(customList) > 0 { for _, item := range customList { - if err := limiter.Wait(ctx); err != nil { + err := limiter.Wait(ctx) + if err != nil { return lambdasListOutput, fmt.Errorf("rate limiter interrupted: %w", err) } @@ -559,7 +561,8 @@ func getAllLambdaVersion( p := lambda.NewListVersionsByFunctionPaginator(svc, input) for p.HasMorePages() { - if err := limiter.Wait(ctx); err != nil { + err := limiter.Wait(ctx) + if err != nil { return lambdasLisOutput, fmt.Errorf("rate limiter interrupted: %w", err) } @@ -583,7 +586,8 @@ func getAllLambdaVersion( var aliasesOut []types.AliasConfiguration for pg.HasMorePages() { - if err := limiter.Wait(ctx); err != nil { + err := limiter.Wait(ctx) + if err != nil { return lambdasLisOutput, fmt.Errorf("rate limiter interrupted: %w", err) } @@ -649,7 +653,7 @@ func getLambdaStorage(list []types.FunctionConfiguration) (int64, error) { ) for _, item := range list { - sizeCounter = sizeCounter + item.CodeSize + sizeCounter += item.CodeSize } return sizeCounter, returnError diff --git a/cmd/version.go b/cmd/version.go index 0f0f95d..0908d6a 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -96,7 +96,8 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri if resp != nil && resp.Body != nil { defer func() { - if closeErr := resp.Body.Close(); closeErr != nil { + closeErr := resp.Body.Close() + if closeErr != nil { log.WithFields(log.Fields{ "package": "cmd", "file": "version.go", @@ -121,7 +122,8 @@ func checkForNewRelease(client *http.Client, currentVersion, useragent, url stri return output, message, fmt.Errorf("%w: %s", errConnectReleaseEndpoint, url) } // Unmarshal the JSON to the Github Release strcut - if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { + err = json.NewDecoder(resp.Body).Decode(&release) + if err != nil { log.WithFields(log.Fields{ "package": "cmd", "file": "version.go", diff --git a/internal/config.go b/internal/config.go index 2258490..15f6465 100644 --- a/internal/config.go +++ b/internal/config.go @@ -70,7 +70,8 @@ func readConfigFileYAML(file string) (CustomDeleteListYAML, error) { dc := yaml.NewDecoder(strings.NewReader(string(fileContent))) dc.KnownFields(true) - if err := dc.Decode(&list); err != nil { + err = dc.Decode(&list) + if err != nil { return list, fmt.Errorf("%w. Ensure the file is in the correct format and that all fields are correct: %w", errDecodeYAMLFile, err) } From 5a6d8ed42afe7f22d6695db1f26c77e3d7a647b6 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 21:07:46 -0700 Subject: [PATCH 5/7] ci: update versions Co-authored-by: Copilot --- .github/workflows/nightly.yaml | 4 ++-- .github/workflows/pull_request.yml | 2 +- .github/workflows/release.yml | 4 ++-- Dockerfile | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 6c9b23b..1a623f1 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -8,8 +8,8 @@ on: env: - GO_VERSION: '1.24' - + GO_VERSION: '1.26.2' + jobs: build-and-release: runs-on: ubuntu-latest diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7423ebd..31ee431 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -10,7 +10,7 @@ permissions: packages: write env: - GO_VERSION: '1.26' + GO_VERSION: '1.26.2' jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcafdef..05e8597 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - GO_VERSION: '1.26' + GO_VERSION: '1.26.2' UPX_VERSION: "5.1.0" SVU_VERSION: "3.3.0" @@ -118,7 +118,7 @@ jobs: - uses: actions/setup-go@v6 with: - go-version: "1.22" + go-version: ${{ env.GO_VERSION }} check-latest: true - name: Set up QEMU diff --git a/Dockerfile b/Dockerfile index e9270a8..1b894d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) karl-cardenas-coding # SPDX-License-Identifier: MIT -FROM golang:1.26.1-alpine3.23 AS builder +FROM golang:1.26.2-alpine3.23 AS builder LABEL org.opencontainers.image.source="http://github.com/karl-cardenas-coding/go-lambda-cleanup" LABEL org.opencontainers.image.description="A solution for removing previous versions of AWS Lambdas" From 04f85fcfc688c0062d312604ce57069abd3daedb Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 21:11:37 -0700 Subject: [PATCH 6/7] ci: add concurrency guard Co-authored-by: Copilot --- .github/workflows/pull_request.yml | 4 ++++ .github/workflows/test.yml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 31ee431..a9ca0f3 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,6 +12,10 @@ permissions: env: GO_VERSION: '1.26.2' +concurrency: + group: "pull_request_${{ github.event.pull_request.number }}" + cancel-in-progress: true + jobs: run-ci: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94ba6fb..23b3669 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,11 @@ on: env: - GO_VERSION: '1.26' + GO_VERSION: '1.26' + +concurrency: + group: "branch_tests_${{ github.ref }}" + cancel-in-progress: true jobs: test: From beaa09edd719535704fd6a37ca1de857a78b3905 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Thu, 23 Apr 2026 21:13:57 -0700 Subject: [PATCH 7/7] docs: update readme github action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93664c5..0991257 100644 --- a/README.md +++ b/README.md @@ -300,7 +300,7 @@ on: # At 04:00 on every day - cron: '0 04 * * *' env: - VERSION: 'v2.0.19' + VERSION: 'v2.0.20' jobs: build: