From b50cba35eb49554666933a931d344d8f93c7410b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 12 Feb 2025 15:03:00 +0300 Subject: [PATCH] Use Go 1.24 --- auth_test.go | 2 +- go.mod | 2 +- integrity.go | 2 +- list.go | 4 ++-- refresh.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/auth_test.go b/auth_test.go index 1e49e2b..8591ba4 100644 --- a/auth_test.go +++ b/auth_test.go @@ -39,7 +39,7 @@ func TestArgon2i(t *testing.T) { } func BenchmarkParseArgon2i(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { parseArgon2i(argon2iParams) } } diff --git a/go.mod b/go.mod index 5c17a96..bf62d86 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.cypherpunks.su/gocheese/v5 -go 1.21 +go 1.24 require ( go.cypherpunks.su/recfile/v2 v2.0.0 diff --git a/integrity.go b/integrity.go index 242061a..15a0485 100644 --- a/integrity.go +++ b/integrity.go @@ -105,7 +105,7 @@ func goodIntegrity() bool { jobs := make(chan string, 1<<10) var workers sync.WaitGroup workers.Add(runtime.NumCPU()) - for i := 0; i < runtime.NumCPU(); i++ { + for range runtime.NumCPU() { go checker(jobs, &isGood, &workers) } fd, err := os.Open(Root) diff --git a/list.go b/list.go index 9844e76..772c238 100644 --- a/list.go +++ b/list.go @@ -105,7 +105,7 @@ func filenameToVersion(fn string) string { } } cols := strings.Split(fn, "-") - for i := 0; i < len(cols); i++ { + for i := range len(cols) { if len(cols[i]) == 0 { continue } @@ -249,5 +249,5 @@ func serveListDir( } w.Header().Set("X-PyPI-Last-Serial", strconv.FormatInt(serial, 10)) w.Write(buf.Bytes()) - w.Write([]byte(fmt.Sprintf("\n", serial))) + w.Write(fmt.Appendf(nil, "\n", serial)) } diff --git a/refresh.go b/refresh.go index 1f565af..a40ef2a 100644 --- a/refresh.go +++ b/refresh.go @@ -326,7 +326,7 @@ func refreshDir( if !mkdirForPkg(w, r, pkgName) { return false } - for _, lineRaw := range bytes.Split(body, []byte("\n")) { + for lineRaw := range bytes.SplitSeq(body, []byte("\n")) { submatches := PkgPyPI.FindStringSubmatch(string(lineRaw)) if len(submatches) == 0 { continue -- 2.48.1