Skip to content

Commit 6fdb138

Browse files
committed
Stop copying loop var
This is no longer required since go1.22, see https://go.dev/blog/loopvar-preview
1 parent f6dbdd3 commit 6fdb138

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

pkg/sharding/leases/shards.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ func (s Shards) IDs() []string {
7474
func ToShards(leases []coordinationv1.Lease, now time.Time) Shards {
7575
shards := make(Shards, 0, len(leases))
7676
for _, lease := range leases {
77-
l := lease
78-
shards = append(shards, ToShard(&l, now))
77+
shards = append(shards, ToShard(&lease, now))
7978
}
8079
return shards
8180
}

webhosting-operator/cmd/experiment/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ func main() {
153153
}
154154
cmd.AddGroup(&group)
155155

156-
for _, s := range experiment.GetAllScenarios() {
157-
scenario := s
158-
156+
for _, scenario := range experiment.GetAllScenarios() {
159157
cmd.AddCommand(&cobra.Command{
160158
Use: scenario.Name(),
161159
Short: scenario.Description(),

webhosting-operator/pkg/metrics/theme.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ func (e *ThemeExporter) Collect(ch chan<- prometheus.Metric) {
7777
return
7878
}
7979

80-
for _, item := range themeList.Items {
81-
theme := item
82-
80+
for _, theme := range themeList.Items {
8381
staticLabels := generateThemeStaticLabels(&theme)
8482

8583
for _, desc := range themeMetrics {

webhosting-operator/pkg/metrics/website.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ func (e *WebsiteExporter) Collect(ch chan<- prometheus.Metric) {
7878
return
7979
}
8080

81-
for _, item := range websiteList.Items {
82-
website := item
83-
81+
for _, website := range websiteList.Items {
8482
staticLabels := generateWebsiteStaticLabels(&website)
8583

8684
for _, desc := range websiteMetrics {

0 commit comments

Comments
 (0)