mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
build: use Go 1.22 range over ints
Done with: ``` git grep -l 'for.*:= 0.*++' \ | xargs sed -i -E 's/for (.*) := 0; \1 < (.*); \1\+\+/for \1 := range \2/' ``` And a few manual fixes due to unused variables. There is something fishy in BMP rib test. Add a comment about that. This is not equivalent (as with range, random is evaluated once, while in the original loop, it is evaluated at each iteration). I believe the intent was to behave like with range.
This commit is contained in:
@@ -78,7 +78,7 @@ func DefaultValuesUnmarshallerHook[Configuration any](defaultConfiguration Confi
|
||||
// Which field is not to the default value in the default configuration?
|
||||
found := map[string]bool{}
|
||||
defaultV := reflect.ValueOf(defaultConfiguration)
|
||||
for i := 0; i < defaultV.NumField(); i++ {
|
||||
for i := range defaultV.NumField() {
|
||||
if !defaultV.Field(i).IsZero() {
|
||||
found[defaultV.Type().Field(i).Name] = false
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func ParametrizedConfigurationUnmarshallerHook[OuterConfiguration any, InnerConf
|
||||
return nil, errors.New("configuration should not have a `config' key")
|
||||
default:
|
||||
t := to.Type()
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
for i := range t.NumField() {
|
||||
if MapStructureMatchName(keyStr, t.Field(i).Name) {
|
||||
// Don't touch
|
||||
continue outer
|
||||
|
||||
Reference in New Issue
Block a user