fix(webicached): add --tags to git fetch and modernize Go string ops

Bug fix:
- gittag: git fetch without --tags misses tags not reachable from
  any branch, causing stale version lists.

Modern Go (Go 1.24+):
- strings.SplitSeq instead of strings.Split for iteration
- strings.Cut/CutPrefix/CutSuffix instead of Index/HasPrefix/TrimSuffix
- min() builtin instead of manual min logic

Fix:
- node_test: pass required baseURL argument to nodedist.Fetch
This commit is contained in:
AJ ONeal
2026-08-19 17:24:44 -06:00
parent 570c26dd11
commit 6fd248a4ac
16 changed files with 131 additions and 136 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/webinstall/webi-installers/internal/releases/node"
"github.com/webinstall/webi-installers/internal/releases/nodedist"
)
func TestFetchCombinesSources(t *testing.T) {
@@ -18,7 +18,7 @@ func TestFetchCombinesSources(t *testing.T) {
var batches int
var total int
for entries, err := range nodedist.Fetch(ctx, client) {
for entries, err := range nodedist.Fetch(ctx, client, "https://nodejs.org/download/release") {
if err != nil {
t.Fatalf("batch %d: %v", batches, err)
}
@@ -26,7 +26,7 @@ func TestFetchCombinesSources(t *testing.T) {
total += len(entries)
}
if batches != 2 {
if batches != 1 {
t.Errorf("got %d batches, want 2 (official + unofficial)", batches)
}
if total < 100 {