diff --git a/go.mod b/go.mod index 056403310..0c981072f 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/go-slug v0.16.4 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/jsonapi v1.4.1 + github.com/hashicorp/jsonapi v1.4.2 github.com/stretchr/testify v1.10.0 go.uber.org/mock v0.4.0 golang.org/x/sync v0.10.0 diff --git a/go.sum b/go.sum index 717a98641..52d5f7072 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/jsonapi v1.4.1 h1:U6CZvnS70Sg7im0kpfhWAoF3NasLumaMndQhEWniHZA= -github.com/hashicorp/jsonapi v1.4.1/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM= +github.com/hashicorp/jsonapi v1.4.2 h1:xStWfremTIAi9cIMyiwt+Vpzq0SOLzekr08LLJQPoB0= +github.com/hashicorp/jsonapi v1.4.2/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/helper_test.go b/helper_test.go index 6d7062426..44d42dcb1 100644 --- a/helper_test.go +++ b/helper_test.go @@ -1251,9 +1251,8 @@ func applyableStatuses(r *Run) []RunStatus { } } else if r.CostEstimate != nil { return []RunStatus{RunCostEstimated} - } else { - return []RunStatus{RunPlanned} } + return []RunStatus{RunPlanned} } // pollRunStatus will poll the given run until its status matches one of the given run statuses or the given context diff --git a/internal_run_task.go b/internal_run_task.go index ee62fcf82..193d139ba 100644 --- a/internal_run_task.go +++ b/internal_run_task.go @@ -43,18 +43,22 @@ func (irt internalRunTask) ToRunTask() *RunTask { obj.WorkspaceRunTasks = workspaceTasks // Check if the global configuration exists - if val, ok := irt.RawGlobal["enabled"]; !ok { + val, ok := irt.RawGlobal["enabled"] + if !ok { // The enabled property is required so we can assume now that the // global configuration was not supplied return &obj - } else if boolVal, ok := val.(bool); !ok { + } + + boolVal, ok := val.(bool) + if !ok { // The enabled property exists but it is invalid (Couldn't cast to boolean) // so assume the global configuration was not supplied return &obj - } else { - obj.Global = &GlobalRunTask{ - Enabled: boolVal, - } + } + + obj.Global = &GlobalRunTask{ + Enabled: boolVal, } // Global Enforcement Level diff --git a/run_task_integration_test.go b/run_task_integration_test.go index ba1811cfb..ec6e6c9cb 100644 --- a/run_task_integration_test.go +++ b/run_task_integration_test.go @@ -15,13 +15,13 @@ import ( func hasGlobalRunTasks(client *Client, organizationName string) (bool, error) { ctx := context.Background() - if orgEntitlements, err := client.Organizations.ReadEntitlements(ctx, organizationName); err != nil { + orgEntitlements, err := client.Organizations.ReadEntitlements(ctx, organizationName) + if err != nil { return false, err } else if orgEntitlements == nil { return false, errors.New("The organization entitlements are empty.") - } else { - return orgEntitlements.GlobalRunTasks, nil } + return orgEntitlements.GlobalRunTasks, nil } func TestRunTasksCreate(t *testing.T) {