diff --git a/go.mod b/go.mod index 5b141793d..8e84a9c1a 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/hetznercloud/cli go 1.25.0 -toolchain go1.26.8 +toolchain go1.27.1 require ( github.com/BurntSushi/toml v1.6.0 diff --git a/internal/state/config/preferences.go b/internal/state/config/preferences.go index c1db41666..05493a2d2 100644 --- a/internal/state/config/preferences.go +++ b/internal/state/config/preferences.go @@ -3,6 +3,7 @@ package config import ( "bytes" "fmt" + "slices" "strings" "github.com/BurntSushi/toml" @@ -57,8 +58,8 @@ func (p Preferences) Unset(key string) bool { _, ok := m[key] delete(m, key) // delete parent maps if they are empty - for i := len(parents) - 1; i >= 0; i-- { - if len(parents[i]) == 0 { + for i, parent := range slices.Backward(parents) { + if len(parent) == 0 { if i > 0 { delete(parents[i-1], path[i-1]) } diff --git a/mise.toml b/mise.toml index 96bff494e..03aedbcb1 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,5 @@ [tools] -go = "1.26.8" +go = "1.27.1" "go:go.uber.org/mock/mockgen" = "v0.6.0" "github:golangci/golangci-lint" = "2.14.0" "github:goreleaser/goreleaser" = "v2.18.2"