From 4447593e572d9d2e7207e9199397e2f54ec08334 Mon Sep 17 00:00:00 2001 From: Neal-C Date: Thu, 24 Oct 2024 13:19:43 +0200 Subject: [PATCH] fix: fixed risk of infinite loop --- internal/cli/thanos_snap.go | 18 +++++++++--------- internal/cli/version.go | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/cli/thanos_snap.go b/internal/cli/thanos_snap.go index e40dbb9..c2b8981 100644 --- a/internal/cli/thanos_snap.go +++ b/internal/cli/thanos_snap.go @@ -69,6 +69,14 @@ var thanosSnap = &cobra.Command{ fmt.Printf("running as %s\n", user.Username) + var shouldRunAgain bool + + payload := map[string]any{ + "private": true, + } + + run: + publicRepositoriesGithubAPIEndpoint := fmt.Sprintf("https://api.github.com/users/%s/repos?visibility=public&per_page=100", user.Username) httpResponse, err := client.Request(http.MethodGet, publicRepositoriesGithubAPIEndpoint, nil) @@ -87,7 +95,7 @@ var thanosSnap = &cobra.Command{ var namesOfPublicRepositories []string for _, repo := range publicRepositories { - namesOfPublicRepositories= append(namesOfPublicRepositories, repo.Fullname) + namesOfPublicRepositories = append(namesOfPublicRepositories, repo.Fullname) } names, err := Prettyfy(namesOfPublicRepositories) @@ -98,14 +106,6 @@ var thanosSnap = &cobra.Command{ fmt.Printf("your public repositories : %s \n", names) - var shouldRunAgain bool - - payload := map[string]any{ - "private": true, - } - - run: - // TODO : lobby github for a batch request endpoint, so that it can be only 1 HTTP call and not O(n) HTTP calls for _, repo := range publicRepositories { diff --git a/internal/cli/version.go b/internal/cli/version.go index bff4655..a9a1bef 100644 --- a/internal/cli/version.go +++ b/internal/cli/version.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "v0.1.1" +var Version = "v0.1.2" var versionCmd = &cobra.Command{ Use: "version",