perf(config): avoid copying structs in server validation loop
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in -24m8s
Build , Vet Test, and Lint / Lint Code (push) Successful in -24m1s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 3m8s
Tests / Unit Tests (push) Successful in -25m22s
Build , Vet Test, and Lint / Build (push) Successful in -25m1s
Tests / Integration Tests (push) Failing after 1m38s

- Use indexing instead of range value to prevent 208 byte copies per iteration
This commit is contained in:
2026-01-03 01:50:56 +02:00
parent 250fcf686c
commit c864aa4d90

View File

@@ -79,7 +79,8 @@ func (sc *ServersConfig) Validate() error {
}
// Validate each instance
for name, instance := range sc.Instances {
for name := range sc.Instances {
instance := sc.Instances[name]
if instance.Name != name {
return fmt.Errorf("server instance name mismatch: key='%s', name='%s'", name, instance.Name)
}