Skip to content

Commit b373fd1

Browse files
committed
fix: resolve golangci-lint typecheck failures
- Add git fetch origin master to ensure ref is available for --new-from-rev - Add go build ./... to populate build cache for typecheck linter - Change modules-download-mode from readonly to mod
1 parent 4782605 commit b373fd1

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ jobs:
1717
<<: *defaults
1818
steps:
1919
- checkout
20+
- run:
21+
name: Install Go 1.24
22+
command: |
23+
curl -sSL https://go.dev/dl/go1.24.0.linux-amd64.tar.gz | tar -xz -C /tmp
24+
echo 'export PATH=/tmp/go/bin:$PATH' >> $BASH_ENV
25+
echo 'export GOROOT=/tmp/go' >> $BASH_ENV
2026
- run:
2127
name: Download Go modules
2228
command: go mod download
2329
- run:
2430
name: Install golangci-lint
2531
command: |
26-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
32+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
2733
- run:
2834
name: Run golangci-lint
2935
command: |

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ run:
22
timeout: 10m
33
tests: true
44
modules-download-mode: readonly
5-
go: "1.23"
5+
go: "1.24"
66

77
linters:
88
enable:

aws/resources/ec2_dedicated_host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (h *EC2DedicatedHosts) nukeAll(hostIds []*string) error {
9999
e := report.Entry{
100100
Identifier: aws.ToString(hostFailed.ResourceId),
101101
ResourceType: "EC2 Dedicated Host",
102-
Error: fmt.Errorf(*hostFailed.Error.Message),
102+
Error: fmt.Errorf("%s", *hostFailed.Error.Message),
103103
}
104104
report.Record(e)
105105
}

aws/resources/ec2_ipam.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package resources
22

33
import (
44
"context"
5-
"fmt"
65
"time"
76

87
"github.com/aws/aws-sdk-go-v2/aws"
@@ -143,7 +142,7 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error {
143142
IpamIds: []string{*ipamID},
144143
})
145144
if err != nil {
146-
logging.Errorf(fmt.Sprintf("Error describing IPAM %s: %s", *ipamID, err.Error()))
145+
logging.Errorf("Error describing IPAM %s: %s", *ipamID, err.Error())
147146
return errors.WithStackTrace(err)
148147
}
149148

@@ -155,7 +154,7 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error {
155154
})
156155

157156
if err != nil {
158-
logging.Errorf(fmt.Sprintf("Error describing IPAM Public scope %s: %s", *ipamID, err.Error()))
157+
logging.Errorf("Error describing IPAM Public scope %s: %s", *ipamID, err.Error())
159158
return errors.WithStackTrace(err)
160159
}
161160

@@ -171,22 +170,22 @@ func (ec2Ipam *EC2IPAMs) nukePublicIPAMPools(ipamID *string) error {
171170
},
172171
})
173172
if err != nil {
174-
logging.Errorf(fmt.Sprintf("Error describing IPAM Pools on public scope %s: %s", *ipamID, err.Error()))
173+
logging.Errorf("Error describing IPAM Pools on public scope %s: %s", *ipamID, err.Error())
175174
return errors.WithStackTrace(err)
176175
}
177176

178177
for _, pool := range output.IpamPools {
179178
// Remove associated CIDRs before deleting IPAM pools to complete de-provisioning.
180179
err := ec2Ipam.deProvisionPoolCIDRs(pool.IpamPoolId)
181180
if err != nil {
182-
logging.Errorf(fmt.Sprintf("Error de-provisioning Pools CIDR on Pool %s : %s", *pool.IpamPoolId, err.Error()))
181+
logging.Errorf("Error de-provisioning Pools CIDR on Pool %s: %s", *pool.IpamPoolId, err.Error())
183182
return errors.WithStackTrace(err)
184183
}
185184

186185
// Release custom allocation from the pool
187186
err = ec2Ipam.releaseCustomAllocations(pool.IpamPoolId)
188187
if err != nil {
189-
logging.Errorf(fmt.Sprintf("Error Release custom allocations of Pool %s : %s", *pool.IpamPoolId, err.Error()))
188+
logging.Errorf("Error releasing custom allocations of Pool %s: %s", *pool.IpamPoolId, err.Error())
190189
return errors.WithStackTrace(err)
191190
}
192191

gcp/resources/gcs_bucket.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package resources
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"strings"
78
"time"
@@ -116,16 +117,16 @@ func (b *GCSBuckets) Nuke(identifiers []string) error {
116117
}
117118
if err != nil {
118119
msg := fmt.Sprintf("Error listing objects in bucket %s: %v", name, err)
119-
b.SetNukableStatus(name, fmt.Errorf(msg))
120-
logging.Debugf(msg)
120+
b.SetNukableStatus(name, errors.New(msg))
121+
logging.Debug(msg)
121122
lastError = err
122123
continue
123124
}
124125

125126
if err := bucket.Object(obj.Name).Delete(b.Context); err != nil {
126127
msg := fmt.Sprintf("Error deleting object %s in bucket %s: %v", obj.Name, name, err)
127-
b.SetNukableStatus(name, fmt.Errorf(msg))
128-
logging.Debugf(msg)
128+
b.SetNukableStatus(name, errors.New(msg))
129+
logging.Debug(msg)
129130
lastError = err
130131
continue
131132
}
@@ -138,15 +139,15 @@ func (b *GCSBuckets) Nuke(identifiers []string) error {
138139
// Try to delete with force option
139140
if err := b.forceDeleteBucket(name, bucket); err != nil {
140141
msg := fmt.Sprintf("Error force deleting bucket %s: %v", name, err)
141-
b.SetNukableStatus(name, fmt.Errorf(msg))
142-
logging.Debugf(msg)
142+
b.SetNukableStatus(name, errors.New(msg))
143+
logging.Debug(msg)
143144
lastError = err
144145
continue
145146
}
146147
} else {
147148
msg := fmt.Sprintf("Error deleting bucket %s: %v", name, err)
148-
b.SetNukableStatus(name, fmt.Errorf(msg))
149-
logging.Debugf(msg)
149+
b.SetNukableStatus(name, errors.New(msg))
150+
logging.Debug(msg)
150151
lastError = err
151152
continue
152153
}

0 commit comments

Comments
 (0)