diff --git a/cmd/runner/tui.go b/cmd/runner/tui.go index 7513f09..187dbc9 100644 --- a/cmd/runner/tui.go +++ b/cmd/runner/tui.go @@ -3,7 +3,7 @@ package runner import ( "fmt" "io" - "io/ioutil" + "os" "os/exec" "sync" "sync/atomic" @@ -78,13 +78,13 @@ func (t *tui) createIfNotExists(acct resource.Account) { t.main.SetText(tview.TranslateANSI(currText())) }) - file, err := ioutil.TempFile("/tmp", acctId) + file, err := os.CreateTemp("/tmp", acctId) if err != nil { panic(err) } setter := func() string { - bytes, err := ioutil.ReadFile(file.Name()) + bytes, err := os.ReadFile(file.Name()) if err != nil { fmt.Printf("ERR: %s \n", err) return "" diff --git a/lib/telophase/account.go b/lib/telophase/account.go index c79ac4a..e2f20ec 100644 --- a/lib/telophase/account.go +++ b/lib/telophase/account.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" ) @@ -35,7 +35,7 @@ func UpsertAccount(accountID string, accountName string) { } if resp.StatusCode != 200 { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { fmt.Println(err) } @@ -58,7 +58,7 @@ func RecordDeploy(accountID string, accountName string) { } if resp.StatusCode != 200 { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { fmt.Println(err) } diff --git a/lib/terraform/local.go b/lib/terraform/local.go index e74f62c..ae29481 100644 --- a/lib/terraform/local.go +++ b/lib/terraform/local.go @@ -5,7 +5,6 @@ import ( "encoding/hex" "fmt" "io/fs" - "io/ioutil" "os" "path" "path/filepath" @@ -57,7 +56,7 @@ func replaceVariablesInFile(srcFile, dstFile string, resource resource.Resource, return oops.Wrapf(err, "error accessing file %s", srcFile) } - content, err := ioutil.ReadFile(srcFile) + content, err := os.ReadFile(srcFile) if err != nil { return err } @@ -81,5 +80,5 @@ func replaceVariablesInFile(srcFile, dstFile string, resource resource.Resource, return oops.Errorf("Region needs to be set on stack if performing substitution") } - return ioutil.WriteFile(dstFile, []byte(updatedContent), fileInfo.Mode()) + return os.WriteFile(dstFile, []byte(updatedContent), fileInfo.Mode()) } diff --git a/lib/ymlparser/organization.go b/lib/ymlparser/organization.go index 036311f..1763721 100644 --- a/lib/ymlparser/organization.go +++ b/lib/ymlparser/organization.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "io/ioutil" "os" "github.com/aws/aws-sdk-go/aws" @@ -34,7 +33,7 @@ func (o Parser) ParseOrganization(ctx context.Context, filepath string) (*resour return nil, errors.New("filepath is empty") } - data, err := ioutil.ReadFile(filepath) + data, err := os.ReadFile(filepath) if err != nil { return nil, fmt.Errorf("err: %s reading file %s", err.Error(), filepath) } @@ -65,7 +64,7 @@ func (o Parser) ParseOrganization(ctx context.Context, filepath string) (*resour func (p Parser) hydrateOUFilepaths(ctx context.Context, ou *resource.OrganizationUnit) error { if ou.OUFilepath != nil { - data, err := ioutil.ReadFile(*ou.OUFilepath) + data, err := os.ReadFile(*ou.OUFilepath) if err != nil { return fmt.Errorf("err: %s reading file for OUFilepath %s", err.Error(), *ou.OUFilepath) } @@ -222,7 +221,7 @@ func WriteOrgFile(filepath string, org *resource.OrganizationUnit) error { return fmt.Errorf("file %s already exists we will not overwrite it", filepath) } - if err := ioutil.WriteFile(filepath, result, 0644); err != nil { + if err := os.WriteFile(filepath, result, 0644); err != nil { return err } diff --git a/resourceoperation/account.go b/resourceoperation/account.go index 6af1692..e563472 100644 --- a/resourceoperation/account.go +++ b/resourceoperation/account.go @@ -56,7 +56,7 @@ func (ao *accountOperation) SetAllowDelete(allowDelete bool) { ao.AllowDelete = allowDelete } -func (ao *accountOperation) SetDelegateAdminPrincipal(principal string) { +func (ao *accountOperation) SetDelegatedAdminPrincipal(principal string) { ao.DelegateAdminPrincipal = principal } diff --git a/resourceoperation/organization_unit.go b/resourceoperation/organization_unit.go index 2e95b02..66fbb4b 100644 --- a/resourceoperation/organization_unit.go +++ b/resourceoperation/organization_unit.go @@ -269,7 +269,7 @@ func CollectOrganizationUnitOps( nil, nil, ) - op.SetDelegateAdminPrincipal(delegatedAdminService) + op.SetDelegatedAdminPrincipal(delegatedAdminService) operations = append(operations, op) } } diff --git a/tests/end2end_test.go b/tests/end2end_test.go index 8d812f8..9dd5db4 100644 --- a/tests/end2end_test.go +++ b/tests/end2end_test.go @@ -3,7 +3,7 @@ package tests import ( "context" "fmt" - "io/ioutil" + "os" "runtime/debug" "testing" @@ -1071,7 +1071,7 @@ func TestEndToEnd(t *testing.T) { compareOrganizationUnits(t, test.OrgInitialState, &fetchedOrg, true) } - err = ioutil.WriteFile("organization.yml", []byte(test.OrgYaml), 0644) + err = os.WriteFile("organization.yml", []byte(test.OrgYaml), 0644) assert.NoError(t, err, "Failed to write organization.yml") parsedOrg, err := ymlparser.NewParser(orgClient).ParseOrganization(ctx, "organization.yml")