From cfee5408af1dd35a64d4502db571530eed8f914a Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Thu, 15 Feb 2024 22:30:41 -0300 Subject: [PATCH] fix lint + fix regression on cloud config legacy file --- commands/cloud_deploy.go | 4 ---- services/cloud/api/deploy_create.go | 2 +- services/cloud/api/endpoint.go | 2 +- services/cloud/deploy_validator.go | 3 --- services/cloud/deployer.go | 12 +++++++----- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/commands/cloud_deploy.go b/commands/cloud_deploy.go index 13284882..d3900741 100644 --- a/commands/cloud_deploy.go +++ b/commands/cloud_deploy.go @@ -17,10 +17,6 @@ import ( "github.com/spf13/cobra" ) -const ( - koolDeployEnv = "kool.deploy.env" -) - // KoolCloudDeployFlags holds the flags for the kool cloud deploy command type KoolCloudDeployFlags struct { // Token string // env: KOOL_API_TOKEN diff --git a/services/cloud/api/deploy_create.go b/services/cloud/api/deploy_create.go index 5e83f1a2..bd5728d4 100644 --- a/services/cloud/api/deploy_create.go +++ b/services/cloud/api/deploy_create.go @@ -41,7 +41,7 @@ func NewDeployCreate() (c *DeployCreate) { } c.SetPath("deploy/create") - c.PostField("is_local", "1") + _ = c.PostField("is_local", "1") return } diff --git a/services/cloud/api/endpoint.go b/services/cloud/api/endpoint.go index e4e3ea9a..75601d12 100644 --- a/services/cloud/api/endpoint.go +++ b/services/cloud/api/endpoint.go @@ -159,7 +159,7 @@ func (e *DefaultEndpoint) DoCall() (err error) { err = e.mockErr if e.mockResp != nil { raw, _ := json.Marshal(e.mockResp) - json.Unmarshal(raw, e.response) + _ = json.Unmarshal(raw, e.response) } return } diff --git a/services/cloud/deploy_validator.go b/services/cloud/deploy_validator.go index 81c722ba..7c0c0420 100644 --- a/services/cloud/deploy_validator.go +++ b/services/cloud/deploy_validator.go @@ -88,9 +88,6 @@ func ParseCloudConfig(workingDir string, koolDeployFile string) (deployConfig *D err = fmt.Errorf("could not find required file '%s' on current working directory: %v", koolDeployFile, err) return } - - koolDeployFile = "kool.deploy.yml" - return } if content, err = os.ReadFile(path); err != nil { diff --git a/services/cloud/deployer.go b/services/cloud/deployer.go index 7e7abb0f..28c2d14d 100644 --- a/services/cloud/deployer.go +++ b/services/cloud/deployer.go @@ -25,12 +25,14 @@ func NewDeployer() *Deployer { func (d *Deployer) CreateDeploy(tarballPath string) (resp *api.DeployCreateResponse, err error) { var create = api.NewDeployCreate() - create.PostFile("deploy", tarballPath, "deploy.tgz") + if err = create.PostFile("deploy", tarballPath, "deploy.tgz"); err != nil { + return + } - create.PostField("cluster", d.env.Get("KOOL_CLOUD_CLUSTER")) - create.PostField("domain", d.env.Get("KOOL_DEPLOY_DOMAIN")) - create.PostField("domain_extras", d.env.Get("KOOL_DEPLOY_DOMAIN_EXTRAS")) - create.PostField("www_redirect", d.env.Get("KOOL_DEPLOY_WWW_REDIRECT")) + _ = create.PostField("cluster", d.env.Get("KOOL_CLOUD_CLUSTER")) + _ = create.PostField("domain", d.env.Get("KOOL_DEPLOY_DOMAIN")) + _ = create.PostField("domain_extras", d.env.Get("KOOL_DEPLOY_DOMAIN_EXTRAS")) + _ = create.PostField("www_redirect", d.env.Get("KOOL_DEPLOY_WWW_REDIRECT")) resp, err = create.Run()