Merge branch 'main' into delete-parallel

This commit is contained in:
Alan Donovan 2021-09-17 09:32:56 -04:00
commit 610ab89c3d
4 changed files with 7 additions and 7 deletions

View file

@ -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)

View file

@ -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...")

View file

@ -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()

View file

@ -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