Skip to content

Commit 7542cbf

Browse files
committed
fix(scylla-manager): address linter complaints
1 parent b34e8be commit 7542cbf

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

pkg/service/backup/list.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func listManifestsInAllLocations(ctx context.Context, client *scyllaclient.Clien
2222
manifests []*ManifestInfo
2323
)
2424

25-
for _, hi := range hosts {
26-
if _, ok := locations[hi.Location]; ok {
25+
for idx := range hosts {
26+
if _, ok := locations[hosts[idx].Location]; ok {
2727
continue
2828
}
29-
locations[hi.Location] = struct{}{}
29+
locations[hosts[idx].Location] = struct{}{}
3030

31-
lm, err := listManifests(ctx, client, hi.IP, hi.Location, clusterID)
31+
lm, err := listManifests(ctx, client, hosts[idx].IP, hosts[idx].Location, clusterID)
3232
if err != nil {
3333
return nil, err
3434
}

pkg/service/backup/parallel.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func makeHostsLimit(hosts []hostInfo, limits []DCLimit) map[string]hostsLimit {
3232
}
3333

3434
m := make(map[string]hostsLimit, len(dcLimit)+1)
35-
for _, h := range hosts {
36-
dc := h.DC
35+
for idx := range hosts {
36+
dc := hosts[idx].DC
3737
// If DC has no limit put host under an empty DC
3838
if _, ok := dcLimit[dc]; !ok {
3939
dc = ""
@@ -42,14 +42,14 @@ func makeHostsLimit(hosts []hostInfo, limits []DCLimit) map[string]hostsLimit {
4242
v, ok := m[dc]
4343
if !ok {
4444
v = hostsLimit{}
45-
v.hosts = []hostInfo{h}
45+
v.hosts = []hostInfo{hosts[idx]}
4646
if dc == "" {
4747
v.limit = globalLimit
4848
} else {
4949
v.limit = dcLimit[dc]
5050
}
5151
} else {
52-
v.hosts = append(v.hosts, h)
52+
v.hosts = append(v.hosts, hosts[idx])
5353
}
5454
m[dc] = v
5555
}

pkg/service/backup/purger_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestStaleTags(t *testing.T) {
7878
retentionMap.Add(task3, 2, 10)
7979
retentionMap.Add(task4, 1, 10)
8080

81-
// test without cleanup
81+
// Test without cleanup
8282
tags, oldest, err := staleTags(manifests, retentionMap, false)
8383
if err != nil {
8484
t.Fatal(err)
@@ -105,7 +105,7 @@ func TestStaleTags(t *testing.T) {
105105
t.Fatalf("staleTags() = %s, diff:\n%s", tags.List(), diff)
106106
}
107107

108-
// test with cleanup
108+
// Test with cleanup
109109
tags, oldest, err = staleTags(manifests, retentionMap, true)
110110
if err != nil {
111111
t.Fatal(err)

pkg/service/backup/validation.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ func (s *Service) Validate(ctx context.Context, clusterID, taskID, runID uuid.UU
176176
p := newPurger(client, h.IP, log.NopLogger)
177177

178178
hostForNodeID := func() string {
179-
for _, h := range hosts {
180-
if h.ID == nodeID {
181-
return h.IP
179+
for idx := range hosts {
180+
if hosts[idx].ID == nodeID {
181+
return hosts[idx].IP
182182
}
183183
}
184184
if host := p.Host(nodeID); host != "" {

pkg/service/backup/worker_schema.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ func (w *worker) UploadSchema(ctx context.Context, hosts []hostInfo) (stepError
9999

100100
// Select single host per location
101101
locations := map[string]hostInfo{}
102-
for _, hi := range hosts {
103-
locations[hi.Location.String()] = hi
102+
for idx := range hosts {
103+
locations[hosts[idx].Location.String()] = hosts[idx]
104104
}
105105
hostPerLocation := make([]hostInfo, 0, len(locations))
106-
for _, hi := range locations {
107-
hostPerLocation = append(hostPerLocation, hi)
106+
for key := range locations {
107+
hostPerLocation = append(hostPerLocation, locations[key])
108108
}
109109

110110
f := func(h hostInfo) error {

0 commit comments

Comments
 (0)