From a4f1fa076b7c1d98d47af20bd698c3036ff50c1d Mon Sep 17 00:00:00 2001 From: Max Beizer Date: Fri, 17 Sep 2021 06:10:37 -0500 Subject: [PATCH] Fix up all the static-check warnings (#162) --- cmd/ghcs/common.go | 2 +- cmd/ghcs/create.go | 2 +- cmd/ghcs/delete.go | 4 ++-- cmd/ghcs/main.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/ghcs/common.go b/cmd/ghcs/common.go index 2f4862e13..e71e3dfe4 100644 --- a/cmd/ghcs/common.go +++ b/cmd/ghcs/common.go @@ -15,7 +15,7 @@ import ( "golang.org/x/term" ) -var errNoCodespaces = errors.New("You have no codespaces.") +var errNoCodespaces = errors.New("you have no codespaces") func chooseCodespace(ctx context.Context, apiClient *api.API, user *api.User) (*api.Codespace, error) { codespaces, err := apiClient.ListCodespaces(ctx, user) diff --git a/cmd/ghcs/create.go b/cmd/ghcs/create.go index 8b7a2e7d9..2125176fd 100644 --- a/cmd/ghcs/create.go +++ b/cmd/ghcs/create.go @@ -82,7 +82,7 @@ func create(opts *createOptions) error { return fmt.Errorf("error getting machine type: %w", err) } if machine == "" { - return errors.New("There are no available machine types for this repository") + return errors.New("there are no available machine types for this repository") } log.Println("Creating your codespace...") diff --git a/cmd/ghcs/delete.go b/cmd/ghcs/delete.go index 961310675..2c0de43ea 100644 --- a/cmd/ghcs/delete.go +++ b/cmd/ghcs/delete.go @@ -28,7 +28,7 @@ func newDeleteCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { switch { case allCodespaces && repo != "": - return errors.New("both --all and --repo is not supported.") + return errors.New("both --all and --repo is not supported") case allCodespaces: return deleteAll(log, force) case repo != "": @@ -166,7 +166,7 @@ func deleteByRepo(log *output.Logger, repo string, force bool) error { } if !deleted { - return fmt.Errorf("No codespace was found for repository: %s", repo) + return fmt.Errorf("no codespace was found for repository: %s", repo) } return list(&listOptions{}) diff --git a/cmd/ghcs/main.go b/cmd/ghcs/main.go index 651d98c1d..7903dad2a 100644 --- a/cmd/ghcs/main.go +++ b/cmd/ghcs/main.go @@ -40,7 +40,7 @@ token to access the GitHub API with.`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if os.Getenv("GITHUB_TOKEN") == "" { - return tokenError + return errTokenMissing } return initLightstep(lightstep) }, @@ -51,10 +51,10 @@ token to access the GitHub API with.`, return root } -var tokenError = errors.New("GITHUB_TOKEN is missing") +var errTokenMissing = errors.New("GITHUB_TOKEN is missing") func explainError(w io.Writer, err error) { - if errors.Is(err, tokenError) { + if errors.Is(err, errTokenMissing) { fmt.Fprintln(w, "The GITHUB_TOKEN environment variable is required. Create a Personal Access Token at https://github.com/settings/tokens/new?scopes=repo") fmt.Fprintln(w, "Make sure to enable SSO for your organizations after creating the token.") return