From 94963cc60926c87dd07dcdaf09e028ee39707aeb Mon Sep 17 00:00:00 2001 From: "Marvin A. Ruder" Date: Sat, 9 Sep 2023 17:58:08 +0200 Subject: [PATCH] Use reference to record and zone for adding reference to client * Fixes [Bug] Zones and Records have `nil` pointer instead of reference to client #2 Signed-off-by: Marvin A. Ruder --- client.go | 3 ++- zone.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 058bb8e..7781504 100644 --- a/client.go +++ b/client.go @@ -71,7 +71,8 @@ func (c *Client) ZonesByKeyword(ctx context.Context, keyword string) ([]Zone, er page = root.Meta.Pagination.NextPage } - for _, z := range zones { + for i := range zones { + z := &zones[i] z.c = c } diff --git a/zone.go b/zone.go index 4213aac..c57429f 100644 --- a/zone.go +++ b/zone.go @@ -97,7 +97,8 @@ func (z *Zone) Records(ctx context.Context) ([]Record, error) { page = root.Meta.Pagination.NextPage } - for _, r := range records { + for i := range records { + r := &records[i] r.c = z.c r.zoneID = r.ID }