diff --git a/api/client/dashbaards_v1_alpha.go b/api/client/dashbaards_v1_alpha.go index 7b1517c..4ef7189 100644 --- a/api/client/dashbaards_v1_alpha.go +++ b/api/client/dashbaards_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" models "github.com/semaphoreci/cli/api/models" @@ -28,11 +27,11 @@ func (c *DashboardApiV1AlphaApi) ListDashboards() (*models.DashboardListV1Alpha, body, status, err := c.BaseClient.List(c.ResourceNamePlural) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) } return models.NewDashboardListV1AlphaFromJson(body) @@ -42,11 +41,11 @@ func (c *DashboardApiV1AlphaApi) GetDashboard(name string) (*models.DashboardV1A body, status, err := c.BaseClient.Get(c.ResourceNamePlural, name) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewDashboardV1AlphaFromJson(body) @@ -70,17 +69,17 @@ func (c *DashboardApiV1AlphaApi) CreateDashboard(d *models.DashboardV1Alpha) (*m json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } body, status, err := c.BaseClient.Post(c.ResourceNamePlural, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewDashboardV1AlphaFromJson(body) @@ -90,7 +89,7 @@ func (c *DashboardApiV1AlphaApi) UpdateDashboard(d *models.DashboardV1Alpha) (*m json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize %s object '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("failed to serialize %s object '%s'", c.ResourceNameSingular, err) } identifier := "" @@ -104,11 +103,11 @@ func (c *DashboardApiV1AlphaApi) UpdateDashboard(d *models.DashboardV1Alpha) (*m body, status, err := c.BaseClient.Patch(c.ResourceNamePlural, identifier, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err)) + return nil, fmt.Errorf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewDashboardV1AlphaFromJson(body) diff --git a/api/client/jobs_v1_alpha.go b/api/client/jobs_v1_alpha.go index 39d04c0..ba4af9b 100644 --- a/api/client/jobs_v1_alpha.go +++ b/api/client/jobs_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" "net/url" @@ -35,11 +34,11 @@ func (c *JobsApiV1AlphaApi) ListJobs(states []string) (*models.JobListV1Alpha, e body, status, err := c.BaseClient.ListWithParams(c.ResourceNamePlural, query) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewJobListV1AlphaFromJson(body) @@ -49,11 +48,11 @@ func (c *JobsApiV1AlphaApi) GetJob(name string) (*models.JobV1Alpha, error) { body, status, err := c.BaseClient.Get(c.ResourceNamePlural, name) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewJobV1AlphaFromJson(body) @@ -64,11 +63,11 @@ func (c *JobsApiV1AlphaApi) GetJobDebugSSHKey(id string) (*models.JobDebugSSHKey body, status, err := c.BaseClient.Get(c.ResourceNamePlural, path) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewJobDebugSSHKeyV1AlphaFromJSON(body) @@ -78,17 +77,17 @@ func (c *JobsApiV1AlphaApi) CreateJob(j *models.JobV1Alpha) (*models.JobV1Alpha, json_body, err := j.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } body, status, err := c.BaseClient.Post(c.ResourceNamePlural, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewJobV1AlphaFromJson(body) @@ -98,18 +97,18 @@ func (c *JobsApiV1AlphaApi) CreateDebugJob(j *models.DebugJobV1Alpha) (*models.J json_body, err := j.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } path := fmt.Sprintf("%s/%s/%s", c.ResourceNamePlural, j.JobId, "debug") body, status, err := c.BaseClient.Post(path, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("creating debug %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("creating debug %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewJobV1AlphaFromJson(body) @@ -120,11 +119,11 @@ func (c *JobsApiV1AlphaApi) StopJob(id string) error { body, status, err := c.BaseClient.Post(path, []byte{}) if err != nil { - return errors.New(fmt.Sprintf("stopping %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return fmt.Errorf("stopping %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return nil diff --git a/api/client/notifications_v1_alpha.go b/api/client/notifications_v1_alpha.go index 1ebe487..d137c07 100644 --- a/api/client/notifications_v1_alpha.go +++ b/api/client/notifications_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" models "github.com/semaphoreci/cli/api/models" @@ -70,7 +69,7 @@ func (c *NotificationsV1AlphaApi) CreateNotification(n *models.NotificationV1Alp json_body, err := n.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } body, status, err := c.BaseClient.Post(c.ResourceNamePlural, json_body) @@ -90,7 +89,7 @@ func (c *NotificationsV1AlphaApi) UpdateNotification(n *models.NotificationV1Alp json_body, err := n.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize %s object '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("failed to serialize %s object '%s'", c.ResourceNameSingular, err) } identifier := "" diff --git a/api/client/pipelines_v1_alpha.go b/api/client/pipelines_v1_alpha.go index b0e07a6..1d20f59 100644 --- a/api/client/pipelines_v1_alpha.go +++ b/api/client/pipelines_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" uuid "github.com/google/uuid" @@ -30,11 +29,11 @@ func (c *PipelinesApiV1AlphaApi) DescribePpl(id string) (*models.PipelineV1Alpha body, status, err := c.BaseClient.Get(c.ResourceNamePlural, detailed) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewPipelineV1AlphaFromJson(body) @@ -46,11 +45,11 @@ func (c *PipelinesApiV1AlphaApi) StopPpl(id string) ([]byte, error) { body, status, err := c.BaseClient.Patch(c.ResourceNamePlural, id, request_body) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil @@ -60,48 +59,48 @@ func (c *PipelinesApiV1AlphaApi) PartialRebuildPpl(id string) ([]byte, error) { requestToken, err := uuid.NewUUID() if err != nil { - return nil, errors.New(fmt.Sprintf("request token generation failed '%s'", err)) + return nil, fmt.Errorf("request token generation failed '%s'", err) } actionArgs := fmt.Sprintf("%s?%s=%s", "partial_rebuild", "request_token", requestToken.String()) body, status, err := c.BaseClient.PostAction(c.ResourceNamePlural, id, actionArgs, []byte("")) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil } func (c *PipelinesApiV1AlphaApi) ListPplByWfID(projectID, wfID string) ([]byte, error) { - detailed := fmt.Sprintf("%s?project_id=%s&wf_id=%s", c.ResourceNamePlural, projectID, wfID) + detailed := fmt.Sprintf("%s?project_id=%s&wf_id=%s", c.ResourceNamePlural, projectID, wfID) body, status, err := c.BaseClient.List(detailed) - if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + if err != nil { + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil } func (c *PipelinesApiV1AlphaApi) ListPpl(projectID string) ([]byte, error) { - detailed := fmt.Sprintf("%s?project_id=%s", c.ResourceNamePlural, projectID) + detailed := fmt.Sprintf("%s?project_id=%s", c.ResourceNamePlural, projectID) body, status, err := c.BaseClient.List(detailed) - if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + if err != nil { + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil diff --git a/api/client/projects_v1_alpha.go b/api/client/projects_v1_alpha.go index 85f16fb..2dd07d2 100644 --- a/api/client/projects_v1_alpha.go +++ b/api/client/projects_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" models "github.com/semaphoreci/cli/api/models" @@ -38,11 +37,11 @@ func (c *ProjectApiV1AlphaApi) ListProjects() (*models.ProjectListV1Alpha, error body, status, err := c.BaseClient.List(c.ResourceNamePlural) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewProjectListV1AlphaFromJson(body) @@ -52,11 +51,11 @@ func (c *ProjectApiV1AlphaApi) GetProject(name string) (*models.ProjectV1Alpha, body, status, err := c.BaseClient.Get(c.ResourceNamePlural, name) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewProjectV1AlphaFromJson(body) @@ -80,17 +79,17 @@ func (c *ProjectApiV1AlphaApi) CreateProject(d *models.ProjectV1Alpha) (*models. json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } body, status, err := c.BaseClient.Post(c.ResourceNamePlural, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewProjectV1AlphaFromJson(body) @@ -100,7 +99,7 @@ func (c *ProjectApiV1AlphaApi) UpdateProject(d *models.ProjectV1Alpha) (*models. json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize %s object '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("failed to serialize %s object '%s'", c.ResourceNameSingular, err) } identifier := d.Metadata.Id @@ -108,11 +107,11 @@ func (c *ProjectApiV1AlphaApi) UpdateProject(d *models.ProjectV1Alpha) (*models. body, status, err := c.BaseClient.Patch(c.ResourceNamePlural, identifier, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err)) + return nil, fmt.Errorf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewProjectV1AlphaFromJson(body) diff --git a/api/client/secrets_v1_beta.go b/api/client/secrets_v1_beta.go index c2a16db..e0ab7d2 100644 --- a/api/client/secrets_v1_beta.go +++ b/api/client/secrets_v1_beta.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" models "github.com/semaphoreci/cli/api/models" @@ -28,11 +27,11 @@ func (c *SecretApiV1BetaApi) ListSecrets() (*models.SecretListV1Beta, error) { body, status, err := c.BaseClient.List(c.ResourceNamePlural) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewSecretListV1BetaFromJson(body) @@ -42,11 +41,11 @@ func (c *SecretApiV1BetaApi) GetSecret(name string) (*models.SecretV1Beta, error body, status, err := c.BaseClient.Get(c.ResourceNamePlural, name) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewSecretV1BetaFromJson(body) @@ -70,17 +69,17 @@ func (c *SecretApiV1BetaApi) CreateSecret(d *models.SecretV1Beta) (*models.Secre json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize object '%s'", err)) + return nil, fmt.Errorf("failed to serialize object '%s'", err) } body, status, err := c.BaseClient.Post(c.ResourceNamePlural, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("creating %s on Semaphore failed '%s'", c.ResourceNameSingular, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewSecretV1BetaFromJson(body) @@ -90,7 +89,7 @@ func (c *SecretApiV1BetaApi) UpdateSecret(d *models.SecretV1Beta) (*models.Secre json_body, err := d.ToJson() if err != nil { - return nil, errors.New(fmt.Sprintf("failed to serialize %s object '%s'", c.ResourceNameSingular, err)) + return nil, fmt.Errorf("failed to serialize %s object '%s'", c.ResourceNameSingular, err) } identifier := "" @@ -104,11 +103,11 @@ func (c *SecretApiV1BetaApi) UpdateSecret(d *models.SecretV1Beta) (*models.Secre body, status, err := c.BaseClient.Patch(c.ResourceNamePlural, identifier, json_body) if err != nil { - return nil, errors.New(fmt.Sprintf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err)) + return nil, fmt.Errorf("updating %s on Semaphore failed '%s'", c.ResourceNamePlural, err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewSecretV1BetaFromJson(body) diff --git a/api/client/workflows_v1_alpha.go b/api/client/workflows_v1_alpha.go index 77ecea5..2c53bfd 100644 --- a/api/client/workflows_v1_alpha.go +++ b/api/client/workflows_v1_alpha.go @@ -1,7 +1,6 @@ package client import ( - "errors" "fmt" "github.com/google/uuid" @@ -30,11 +29,11 @@ func (c *WorkflowApiV1AlphaApi) ListWorkflows(project_id string) (*models.Workfl body, status, err := c.BaseClient.List(urlEncode) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return models.NewWorkflowListV1AlphaFromJson(body) @@ -71,18 +70,18 @@ func (c *WorkflowApiV1AlphaApi) StopWf(id string) ([]byte, error) { requestToken, err := uuid.NewUUID() if err != nil { - return nil, errors.New(fmt.Sprintf("request token generation failed '%s'", err)) + return nil, fmt.Errorf("request token generation failed '%s'", err) } actionArgs := fmt.Sprintf("%s?%s=%s", "terminate", "request_token", requestToken.String()) body, status, err := c.BaseClient.PostAction(c.ResourceNamePlural, id, actionArgs, []byte("")) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil @@ -92,18 +91,18 @@ func (c *WorkflowApiV1AlphaApi) Rebuild(id string) ([]byte, error) { requestToken, err := uuid.NewUUID() if err != nil { - return nil, errors.New(fmt.Sprintf("request token generation failed '%s'", err)) + return nil, fmt.Errorf("request token generation failed '%s'", err) } actionArgs := fmt.Sprintf("%s?%s=%s", "reschedule", "request_token", requestToken.String()) body, status, err := c.BaseClient.PostAction(c.ResourceNamePlural, id, actionArgs, []byte("")) if err != nil { - return nil, errors.New(fmt.Sprintf("connecting to Semaphore failed '%s'", err)) + return nil, fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != 200 { - return nil, errors.New(fmt.Sprintf("http status %d with message \"%s\" received from upstream", status, body)) + return nil, fmt.Errorf("http status %d with message \"%s\" received from upstream", status, body) } return body, nil diff --git a/cmd/init.go b/cmd/init.go index b7766f1..abc488a 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -120,7 +120,7 @@ func ConstructProjectName(repo_url string) (string, error) { errTemplate += "To add a project with an alternative git url, use the --repo-url flag:\n" errTemplate += " - sem init --repo-url git@github.com:/.git\n" - return "", errors.New(fmt.Sprintf(errTemplate, repo_url)) + return "", fmt.Errorf(errTemplate, repo_url) } func getGitOriginUrl() (string, error) { diff --git a/generators/yaml.go b/generators/yaml.go index 9ba174b..aaa4ba4 100644 --- a/generators/yaml.go +++ b/generators/yaml.go @@ -1,7 +1,6 @@ package generators import ( - "errors" "flag" "fmt" "io/ioutil" @@ -84,7 +83,7 @@ func GeneratePipelineYaml() error { err := os.Mkdir(".semaphore", 0755) if err != nil { - return errors.New(fmt.Sprintf("failed to create .semaphore directory '%s'", err)) + return fmt.Errorf("failed to create .semaphore directory '%s'", err) } } @@ -93,7 +92,7 @@ func GeneratePipelineYaml() error { if err == nil { return nil } else { - return errors.New(fmt.Sprintf("failed to create %s file '%s'", path, err)) + return fmt.Errorf("failed to create %s file '%s'", path, err) } }