From 00885dffe1dc39b09d928368db525410d866e472 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Sun, 26 Jun 2022 12:35:18 +0200 Subject: [PATCH] Fix implicit memory aliasing in for loop (lint 8/n) --- db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db.go b/db.go index b3222d0e..e412468d 100644 --- a/db.go +++ b/db.go @@ -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().