From c81d6c5528cef74d281c171f38d1eeae6fa0ccdc Mon Sep 17 00:00:00 2001 From: Shawn Yu Date: Mon, 13 May 2024 16:00:05 -0400 Subject: [PATCH] fix: use rand v1 v2 is not included in go 1.21 --- .github/workflows/release.yml | 2 +- utils/utils.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88da9ac..33b1225 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,5 +35,5 @@ jobs: - uses: cli/gh-extension-precompile@v1 with: - go_version: "1.22" + go_version: "1.21" diff --git a/utils/utils.go b/utils/utils.go index ca00d12..500fa2c 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -8,7 +8,9 @@ import ( "github.com/google/go-github/v61/github" "github.com/ktr0731/go-fuzzyfinder" "github.com/shawnyu5/gh-ac/gh" - "math/rand/v2" + // TODO: use V2 once this issue is solved. v2 is not included in go 1.21 + // https://github.com/cli/gh-extension-precompile/issues/50 + "math/rand" "os" "os/exec" "strings" @@ -72,7 +74,7 @@ func OpenInBrowser(args []string) error { // RandomSpinner creates a random spinner func RandomSpinner(suffix string) *spinner.Spinner { - s := spinner.New(spinner.CharSets[rand.IntN(90)], 100*time.Millisecond) + s := spinner.New(spinner.CharSets[rand.Intn(90)], 100*time.Millisecond) s.Suffix = suffix return s }