Fix implicit memory aliasing in for loop (lint 8/n)

This commit is contained in:
Juan Font Alonso 2022-06-26 12:35:18 +02:00
parent ffcc72876c
commit 00885dffe1

4
db.go
View file

@ -89,7 +89,7 @@ func (h *Headscale) initDB() error {
log.Error().Err(err).Msg("Error accessing db")
}
for _, machine := range machines {
for item, machine := range machines {
if machine.GivenName == "" {
normalizedHostname, err := NormalizeToFQDNRules(
machine.Hostname,
@ -103,7 +103,7 @@ func (h *Headscale) initDB() error {
Msg("Failed to normalize machine hostname in DB migration")
}
err = h.RenameMachine(&machine, normalizedHostname)
err = h.RenameMachine(&machines[item], normalizedHostname)
if err != nil {
log.Error().
Caller().