Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tfexec/internal/e2etest/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package e2etest
import (
"context"
"io"
"io/ioutil"
"path/filepath"
"reflect"
"strings"
Expand Down Expand Up @@ -163,7 +162,7 @@ resource "foo" "bar" {
t.Fatal(err)
}

actual, err := ioutil.ReadAll(outR)
actual, err := io.ReadAll(outR)
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 1 addition & 2 deletions tfexec/internal/e2etest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package e2etest

import (
"io/ioutil"
"os"
"testing"

Expand All @@ -15,7 +14,7 @@ var tfcache *testutil.TFCache

func TestMain(m *testing.M) {
os.Exit(func() int {
installDir, err := ioutil.TempDir("", "tfinstall")
installDir, err := os.MkdirTemp("", "tfinstall")
if err != nil {
panic(err)
}
Expand Down
8 changes: 4 additions & 4 deletions tfexec/internal/e2etest/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"encoding/json"
"errors"
"io/ioutil"
"io"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -622,7 +622,7 @@ func TestShowPlanFileRaw012_linux(t *testing.T) {
t.Fatal(err)
}
defer f.Close()
expected, err := ioutil.ReadAll(f)
expected, err := io.ReadAll(f)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -650,7 +650,7 @@ func TestShowPlanFileRaw013(t *testing.T) {
t.Fatal(err)
}
defer f.Close()
expected, err := ioutil.ReadAll(f)
expected, err := io.ReadAll(f)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -678,7 +678,7 @@ func TestShowPlanFileRaw014(t *testing.T) {
t.Fatal(err)
}
defer f.Close()
expected, err := ioutil.ReadAll(f)
expected, err := io.ReadAll(f)
if err != nil {
t.Fatal(err)
}
Expand Down
15 changes: 7 additions & 8 deletions tfexec/internal/e2etest/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"hash/crc32"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -67,7 +66,7 @@ func runTest(t *testing.T, fixtureName string, cb func(t *testing.T, tfVersion *
// prevents any possible confusion that could result from
// reusing an os.TempDir() (for example) that already contained
// Terraform files.
td, err := ioutil.TempDir("", "tf")
td, err := os.MkdirTemp("", "tf")
if err != nil {
t.Fatalf("error creating temporary test directory: %s", err)
}
Expand Down Expand Up @@ -113,7 +112,7 @@ func runTestWithVersions(t *testing.T, versions []string, fixtureName string, cb
}
alreadyRunVersions[tfv] = true

td, err := ioutil.TempDir("", "tf")
td, err := os.MkdirTemp("", "tf")
if err != nil {
t.Fatalf("error creating temporary test directory: %s", err)
}
Expand Down Expand Up @@ -190,7 +189,7 @@ func (t *testingPrintfer) Printf(format string, v ...interface{}) {
}

func copyFiles(path string, dstPath string) error {
infos, err := ioutil.ReadDir(path)
infos, err := os.ReadDir(path)
if err != nil {
return err
}
Expand All @@ -199,7 +198,7 @@ func copyFiles(path string, dstPath string) error {
srcPath := filepath.Join(path, info.Name())
if info.IsDir() {
newDir := filepath.Join(dstPath, info.Name())
err = os.MkdirAll(newDir, info.Mode())
err = os.MkdirAll(newDir, info.Type())
if err != nil {
return err
}
Expand Down Expand Up @@ -249,12 +248,12 @@ func copyFile(path string, dstPath string) error {

// filesEqual asserts that two files have the same contents.
func textFilesEqual(t *testing.T, expected, actual string) {
eb, err := ioutil.ReadFile(expected)
eb, err := os.ReadFile(expected)
if err != nil {
t.Fatal(err)
}

ab, err := ioutil.ReadFile(actual)
ab, err := os.ReadFile(actual)
if err != nil {
t.Fatal(err)
}
Expand All @@ -271,7 +270,7 @@ func textFilesEqual(t *testing.T, expected, actual string) {
}

func checkSum(t *testing.T, filename string) uint32 {
b, err := ioutil.ReadFile(filename)
b, err := os.ReadFile(filename)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions tfexec/internal/testutil/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package testutil

import (
"io/ioutil"
"io"
"log"
"os"
"testing"
Expand All @@ -14,5 +14,5 @@ func TestLogger() *log.Logger {
if testing.Verbose() {
return log.New(os.Stdout, "", log.LstdFlags|log.Lshortfile)
}
return log.New(ioutil.Discard, "", 0)
return log.New(io.Discard, "", 0)
}
3 changes: 1 addition & 2 deletions tfexec/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"runtime"
Expand Down Expand Up @@ -103,7 +102,7 @@ func NewTerraform(workingDir string, execPath string) (*Terraform, error) {
execPath: execPath,
workingDir: workingDir,
env: nil, // explicit nil means copy os.Environ
logger: log.New(ioutil.Discard, "", 0),
logger: log.New(io.Discard, "", 0),
waitDelay: 60 * time.Second,
}

Expand Down
3 changes: 1 addition & 2 deletions tfexec/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package tfexec
import (
"context"
"errors"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand All @@ -27,7 +26,7 @@ func TestMain(m *testing.M) {

os.Exit(func() int {
var err error
installDir, err := ioutil.TempDir("", "tfinstall")
installDir, err := os.MkdirTemp("", "tfinstall")
if err != nil {
panic(err)
}
Expand Down
Loading