diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b279769..b47d28b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: linux: strategy: matrix: - go: ["1.23", "1.24", "1.25"] + go: ["1.24", "1.25"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -31,7 +31,7 @@ jobs: linux-32bit: strategy: matrix: - go: ["1.23"] + go: ["1.24"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -47,7 +47,7 @@ jobs: darwin: strategy: matrix: - go: ["1.23"] + go: ["1.24"] runs-on: macos-15 steps: - uses: actions/checkout@v2 @@ -63,7 +63,7 @@ jobs: linux-stress: strategy: matrix: - go: ["1.23"] + go: ["1.24"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -80,7 +80,7 @@ jobs: linux-stress-race: strategy: matrix: - go: ["1.23"] + go: ["1.24"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -97,7 +97,7 @@ jobs: linux-cockroach-go: runs-on: ubuntu-latest env: - GO_BRANCH: cockroach-go1.23.12 + GO_BRANCH: cockroach-go1.25.3 steps: - uses: actions/checkout@v4 @@ -120,7 +120,7 @@ jobs: - name: Install bootstrap Go uses: actions/setup-go@v5 with: - go-version: "1.23.x" + go-version: "1.24.x" # Step 4: Run tests with custom Go - run: ./scripts/run-tests-with-custom-go.sh ./... diff --git a/crstrings/utils.go b/crstrings/utils.go index edf3902..159a6eb 100644 --- a/crstrings/utils.go +++ b/crstrings/utils.go @@ -16,6 +16,7 @@ package crstrings import ( "fmt" + "iter" "slices" "strings" ) @@ -87,15 +88,20 @@ func FilterEmpty(elems []string) []string { // Lines breaks up the given string into lines. func Lines(s string) []string { + return slices.Collect(LinesSeq(s)) +} + +// LinesSeq returns an iterator over the lines of the given string. +func LinesSeq(s string) iter.Seq[string] { // Remove any trailing newline (to avoid getting an extraneous empty line at // the end). s = strings.TrimSuffix(s, "\n") if s == "" { - // In this case, Split returns a slice with a single empty string (which is - // not what we want). - return nil + // In this case, SplitSeq returns an iterator with a single empty string + // (which is not what we want). + return func(yield func(string) bool) {} } - return strings.Split(s, "\n") + return strings.SplitSeq(s, "\n") } // Indent prepends a string to every line of the given string. diff --git a/go.mod b/go.mod index c07f1cf..35a8e50 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/cockroachdb/crlib -go 1.23 +go 1.24 diff --git a/internal/devtools/go.mod b/internal/devtools/go.mod index d7ce938..f476fb0 100644 --- a/internal/devtools/go.mod +++ b/internal/devtools/go.mod @@ -1,8 +1,8 @@ module github.com/cockroachdb/crlib/internal/devtools -go 1.23 +go 1.24 -toolchain go1.24.2 +toolchain go1.24.10 require ( github.com/cockroachdb/crlfmt v0.2.1 diff --git a/scripts/run-tests-with-custom-go.sh b/scripts/run-tests-with-custom-go.sh index 704f8ae..60121c5 100755 --- a/scripts/run-tests-with-custom-go.sh +++ b/scripts/run-tests-with-custom-go.sh @@ -14,7 +14,7 @@ GO_REPO="https://github.com/cockroachdb/go.git" GO_SHA="${GO_SHA:-}" if [ -z "$GO_SHA" ]; then - GO_BRANCH="${GO_BRANCH:-cockroach-go1.23.12}" + GO_BRANCH="${GO_BRANCH:-cockroach-go1.25.3}" echo "==> Resolving latest SHA for branch $GO_BRANCH..." GO_SHA=$(git ls-remote "$GO_REPO" "refs/heads/$GO_BRANCH" | cut -f1) fi