From 3505f0e0590dffd39290f371cacab49ca3f1c517 Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Wed, 6 May 2026 20:08:04 -0600 Subject: [PATCH] switch to uint64 cause native word length --- internal/cache/cache.go | 2 +- internal/cache/helpers.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 1c297ad..60b409c 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -16,7 +16,7 @@ const userAgent = "pacman/7.1.0 (Linux x86_64) libalpm/16.0.1" type Cache struct { cfg CacheConfig - mirrorIdx atomic.Uint32 + mirrorIdx atomic.Uint64 sf singleflight.Group //prevents duplicate downloads mu sync.Mutex client http.Client diff --git a/internal/cache/helpers.go b/internal/cache/helpers.go index 4726d1c..ccd4bde 100644 --- a/internal/cache/helpers.go +++ b/internal/cache/helpers.go @@ -10,7 +10,8 @@ import ( func (c *Cache) nextMirror() string { idx := c.mirrorIdx.Add(1) - 1 - return c.cfg.mirrorURLs[idx%uint32(len(c.cfg.mirrorURLs))] + mirrorCount := uint64(len(c.cfg.mirrorURLs)) + return c.cfg.mirrorURLs[idx%mirrorCount] } func downloadToDisk(url, destPath string, c http.Client) error {