From 209c34b7632c4cce156df42e19a70d93e193343a Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Thu, 15 Feb 2024 17:46:01 +0000 Subject: [PATCH] Upgrade to Go 1.22 --- .github/workflows/CI.yml | 3 --- .goreleaser.yml | 1 - Makefile | 2 -- go.mod | 2 +- internal/count/count.go | 2 +- internal/count/count_test.go | 2 +- 6 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7f17cdf..bf8349e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,9 +14,6 @@ concurrency: permissions: read-all -env: - GOEXPERIMENT: loopvar - jobs: test: name: Test diff --git a/.goreleaser.yml b/.goreleaser.yml index e862e57..2ad0898 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,7 +15,6 @@ builds: - -X main.commit={{.Commit}} env: - CGO_ENABLED=0 - - GOEXPERIMENT=loopvar goos: - linux - darwin diff --git a/Makefile b/Makefile index 06590ab..89313cb 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,6 @@ COVERAGE_DATA := coverage.out COVERAGE_HTML := coverage.html -export GOEXPERIMENT := loopvar - help: ## Show the list of available tasks @echo "Available Tasks:\n" @grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-10s %s\n", $$1, $$2}' diff --git a/go.mod b/go.mod index 9240b79..690adf5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/FollowTheProcess/gowc -go 1.21 +go 1.22 require github.com/FollowTheProcess/test v0.9.0 diff --git a/internal/count/count.go b/internal/count/count.go index f1f8714..88572e2 100644 --- a/internal/count/count.go +++ b/internal/count/count.go @@ -111,7 +111,7 @@ func All(files []string) (Results, error) { // nWorkers is min of NumCPU and len(files) so we don't start more workers than // is necessary (no point kicking off 8 workers to do 3 files for example) nWorkers := min(runtime.NumCPU(), len(files)) - for i := 0; i < nWorkers; i++ { + for range nWorkers { wg.Add(1) go worker(counts, jobs, &wg) } diff --git a/internal/count/count_test.go b/internal/count/count_test.go index e0f2952..0c48485 100644 --- a/internal/count/count_test.go +++ b/internal/count/count_test.go @@ -267,7 +267,7 @@ func BenchmarkCount(b *testing.B) { r := bytes.NewReader(contents) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { _, err := count.One(r, "bench") if err != nil { b.Fatalf("Count returned an error: %v", err)