Skip to content

Commit 205121b

Browse files
committed
Golangci-lint update (makezero linter)
Makezero checks to prevent bugs caused by initializing a slice with non-constant length and later appending to it. internal/patroni/config.go:257:11: append to slice `hba` with non-zero initialized length (makezero) hba = append(hba, value) ^ internal/patroni/config.go:264:10: append to slice `hba` with non-zero initialized length (makezero) hba = append(hba, pgHBAs.Default[i].String())
1 parent 835ac37 commit 205121b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/patroni/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ func DynamicConfiguration(
246246
postgresql["parameters"] = parameters
247247

248248
// Copy the "postgresql.pg_hba" section after any mandatory values.
249-
hba := make([]string, len(pgHBAs.Mandatory))
249+
hba := make([]string, 0, len(pgHBAs.Mandatory))
250250
for i := range pgHBAs.Mandatory {
251-
hba[i] = pgHBAs.Mandatory[i].String()
251+
hba = append(hba, pgHBAs.Mandatory[i].String())
252252
}
253253
if section, ok := postgresql["pg_hba"].([]interface{}); ok {
254254
for i := range section {

0 commit comments

Comments
 (0)