Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update golang version to 1.22 and adapt loop var improvements #826

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ etcd-druid:
teamname: 'gardener/etcd-druid-maintainers'
steps:
check:
image: 'golang:1.21.4'
image: 'golang:1.22.4'
renormalize marked this conversation as resolved.
Show resolved Hide resolved
test:
image: 'golang:1.21.4'
image: 'golang:1.22.4'
renormalize marked this conversation as resolved.
Show resolved Hide resolved
test_integration:
image: 'golang:1.21.4'
image: 'golang:1.22.4'
renormalize marked this conversation as resolved.
Show resolved Hide resolved
build:
image: 'golang:1.21.4'
image: 'golang:1.22.4'
renormalize marked this conversation as resolved.
Show resolved Hide resolved
output_dir: 'binary'

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21.4 as builder
FROM golang:1.22.4 as builder
renormalize marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /go/src/github.com/gardener/etcd-druid
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gardener/etcd-druid

go 1.21
go 1.22

require (
github.com/gardener/etcd-backup-restore v0.26.0
Expand Down
1 change: 0 additions & 1 deletion internal/component/memberlease/memberlease.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (r _resource) Sync(ctx component.OperatorContext, etcd *druidv1alpha1.Etcd)
var errs error

for i, objKey := range objectKeys {
objKey := objKey // capture the range variable
createTasks[i] = utils.OperatorTask{
Name: "CreateOrUpdate-" + objKey.String(),
Fn: func(ctx component.OperatorContext) error {
Expand Down
1 change: 0 additions & 1 deletion internal/component/snapshotlease/snapshotlease.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func (r _resource) Sync(ctx component.OperatorContext, etcd *druidv1alpha1.Etcd)
syncTasks := make([]utils.OperatorTask, len(objectKeys))

for i, objKey := range objectKeys {
objKey := objKey // capture the range variable
syncTasks[i] = utils.OperatorTask{
Name: "CreateOrUpdate-" + objKey.String(),
Fn: func(ctx component.OperatorContext) error {
Expand Down
2 changes: 0 additions & 2 deletions internal/controller/etcd/reconcile_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ func (r *Reconciler) deleteEtcdResources(ctx component.OperatorContext, etcdObjK
operators := r.operatorRegistry.AllOperators()
deleteTasks := make([]utils.OperatorTask, 0, len(operators))
for kind, operator := range operators {
// TODO: once we move to go 1.22 (https://go.dev/blog/loopvar-preview)
operator := operator
deleteTasks = append(deleteTasks, utils.OperatorTask{
Name: fmt.Sprintf("triggerDeletionFlow-%s-component", kind),
Fn: func(ctx component.OperatorContext) error {
Expand Down
6 changes: 3 additions & 3 deletions internal/health/condition/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func (b *defaultBuilder) WithOldConditions(conditions []druidv1alpha1.Condition)

// WithResults adds the results.
func (b *defaultBuilder) WithResults(results []Result) Builder {
for _, result := range results {
if result == nil {
for _, r := range results {
if r == nil {
continue
}
b.results[result.ConditionType()] = result
b.results[r.ConditionType()] = r
}

return b
Expand Down