]> Cypherpunks repositories - gocheese.git/commitdiff
Use Go 1.24
authorSergey Matveev <stargrave@stargrave.org>
Wed, 12 Feb 2025 12:03:00 +0000 (15:03 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 12 Feb 2025 12:03:00 +0000 (15:03 +0300)
auth_test.go
go.mod
integrity.go
list.go
refresh.go

index 1e49e2bac766f141c98dff9c5c53977de3c08a88..8591ba444bdb6f09578bf65c213beb992bad0f1d 100644 (file)
@@ -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 5c17a961f54385589b66485e647ee672203870c8..bf62d86d2f1162711b47d65c844c15ea4c136e2d 100644 (file)
--- 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
index 242061a13033ec26c42c6e9c7e2ca66bb5753cd1..15a04853462130bb2b6f994361ba7b4f21bbc500 100644 (file)
@@ -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 9844e763c462c5fec2e7309bb0a8e28688df707f..772c2381c6853c45c25249816cf8bf32bcba82e7 100644 (file)
--- 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("<!--SERIAL %d-->\n", serial)))
+       w.Write(fmt.Appendf(nil, "<!--SERIAL %d-->\n", serial))
 }
index 1f565af4fe923da485293bfe64b430ec17cd68b2..a40ef2a9850a02cea2faeab830447674ab94851d 100644 (file)
@@ -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