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 1ff8122b3..d7fb1359e 100644 --- a/cmd/ghcs/delete.go +++ b/cmd/ghcs/delete.go @@ -29,7 +29,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 != "": @@ -178,7 +178,7 @@ func deleteByRepo(log *output.Logger, repo string, force bool) error { }() } if !found { - return fmt.Errorf("No codespace was found for repository: %s", repo) + return fmt.Errorf("no codespace was found for repository: %s", repo) } wg.Wait() 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