diff --git a/.circleci/config.yml b/.circleci/config.yml index 62d3d2d5..5de04c1f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,13 +17,19 @@ jobs: <<: *defaults steps: - checkout + - run: + name: Install Go 1.24 + command: | + curl -sSL https://go.dev/dl/go1.24.0.linux-amd64.tar.gz | tar -xz -C /tmp + echo 'export PATH=/tmp/go/bin:$PATH' >> $BASH_ENV + echo 'export GOROOT=/tmp/go' >> $BASH_ENV - run: name: Download Go modules command: go mod download - run: name: Install golangci-lint command: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8 - run: name: Run golangci-lint command: | diff --git a/.golangci.yml b/.golangci.yml index d758f4c6..a0a0158c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,7 +2,7 @@ run: timeout: 10m tests: true modules-download-mode: readonly - go: "1.23" + go: "1.24" linters: enable: diff --git a/aws/resources/ec2_dedicated_host.go b/aws/resources/ec2_dedicated_host.go index 27d2d60e..eee390ed 100644 --- a/aws/resources/ec2_dedicated_host.go +++ b/aws/resources/ec2_dedicated_host.go @@ -99,7 +99,7 @@ func (h *EC2DedicatedHosts) nukeAll(hostIds []*string) error { e := report.Entry{ Identifier: aws.ToString(hostFailed.ResourceId), ResourceType: "EC2 Dedicated Host", - Error: fmt.Errorf(*hostFailed.Error.Message), + Error: fmt.Errorf("%s", *hostFailed.Error.Message), } report.Record(e) } diff --git a/aws/resources/ec2_ipam.go b/aws/resources/ec2_ipam.go index a0ef49ef..898c07e6 100644 --- a/aws/resources/ec2_ipam.go +++ b/aws/resources/ec2_ipam.go @@ -2,7 +2,6 @@ package resources import ( "context" - "fmt" "time" "github.com/aws/aws-sdk-go-v2/aws" @@ -143,7 +142,7 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error { IpamIds: []string{*ipamID}, }) if err != nil { - logging.Errorf(fmt.Sprintf("Error describing IPAM %s: %s", *ipamID, err.Error())) + logging.Errorf("Error describing IPAM %s: %s", *ipamID, err.Error()) return errors.WithStackTrace(err) } @@ -155,7 +154,7 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error { }) if err != nil { - logging.Errorf(fmt.Sprintf("Error describing IPAM Public scope %s: %s", *ipamID, err.Error())) + logging.Errorf("Error describing IPAM Public scope %s: %s", *ipamID, err.Error()) return errors.WithStackTrace(err) } @@ -171,7 +170,7 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error { }, }) if err != nil { - logging.Errorf(fmt.Sprintf("Error describing IPAM Pools on public scope %s: %s", *ipamID, err.Error())) + logging.Errorf("Error describing IPAM Pools on public scope %s: %s", *ipamID, err.Error()) return errors.WithStackTrace(err) } @@ -179,14 +178,14 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error { // Remove associated CIDRs before deleting IPAM pools to complete de-provisioning. err := ec2Ipam.deProvisionPoolCIDRs(pool.IpamPoolId) if err != nil { - logging.Errorf(fmt.Sprintf("Error de-provisioning Pools CIDR on Pool %s : %s", *pool.IpamPoolId, err.Error())) + logging.Errorf("Error de-provisioning Pools CIDR on Pool %s: %s", *pool.IpamPoolId, err.Error()) return errors.WithStackTrace(err) } // Release custom allocation from the pool err = ec2Ipam.releaseCustomAllocations(pool.IpamPoolId) if err != nil { - logging.Errorf(fmt.Sprintf("Error Release custom allocations of Pool %s : %s", *pool.IpamPoolId, err.Error())) + logging.Errorf("Error releasing custom allocations of Pool %s: %s", *pool.IpamPoolId, err.Error()) return errors.WithStackTrace(err) } diff --git a/gcp/resources/gcs_bucket.go b/gcp/resources/gcs_bucket.go index 4e518b75..e4b0be88 100644 --- a/gcp/resources/gcs_bucket.go +++ b/gcp/resources/gcs_bucket.go @@ -2,6 +2,7 @@ package resources import ( "context" + "errors" "fmt" "strings" "time" @@ -116,16 +117,16 @@ func (b *GCSBuckets) Nuke(identifiers []string) error { } if err != nil { msg := fmt.Sprintf("Error listing objects in bucket %s: %v", name, err) - b.SetNukableStatus(name, fmt.Errorf(msg)) - logging.Debugf(msg) + b.SetNukableStatus(name, errors.New(msg)) + logging.Debug(msg) lastError = err continue } if err := bucket.Object(obj.Name).Delete(b.Context); err != nil { msg := fmt.Sprintf("Error deleting object %s in bucket %s: %v", obj.Name, name, err) - b.SetNukableStatus(name, fmt.Errorf(msg)) - logging.Debugf(msg) + b.SetNukableStatus(name, errors.New(msg)) + logging.Debug(msg) lastError = err continue } @@ -138,15 +139,15 @@ func (b *GCSBuckets) Nuke(identifiers []string) error { // Try to delete with force option if err := b.forceDeleteBucket(name, bucket); err != nil { msg := fmt.Sprintf("Error force deleting bucket %s: %v", name, err) - b.SetNukableStatus(name, fmt.Errorf(msg)) - logging.Debugf(msg) + b.SetNukableStatus(name, errors.New(msg)) + logging.Debug(msg) lastError = err continue } } else { msg := fmt.Sprintf("Error deleting bucket %s: %v", name, err) - b.SetNukableStatus(name, fmt.Errorf(msg)) - logging.Debugf(msg) + b.SetNukableStatus(name, errors.New(msg)) + logging.Debug(msg) lastError = err continue }