mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
internal/command: deprecate ioutil (#318)
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -278,7 +277,7 @@ func TestInit_backendUnset(t *testing.T) {
|
||||
log.Printf("[TRACE] TestInit_backendUnset: beginning second init")
|
||||
|
||||
// Unset
|
||||
if err := ioutil.WriteFile("main.tf", []byte(""), 0644); err != nil {
|
||||
if err := os.WriteFile("main.tf", []byte(""), 0644); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
@@ -892,7 +891,7 @@ func TestInit_backendReinitConfigToExtra(t *testing.T) {
|
||||
|
||||
// init again but remove the path option from the config
|
||||
cfg := "terraform {\n backend \"local\" {}\n}\n"
|
||||
if err := ioutil.WriteFile("main.tf", []byte(cfg), 0644); err != nil {
|
||||
if err := os.WriteFile("main.tf", []byte(cfg), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -2101,7 +2100,7 @@ func TestInit_providerLockFile(t *testing.T) {
|
||||
}
|
||||
|
||||
lockFile := ".terraform.lock.hcl"
|
||||
buf, err := ioutil.ReadFile(lockFile)
|
||||
buf, err := os.ReadFile(lockFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read dependency lock file %s: %s", lockFile, err)
|
||||
}
|
||||
@@ -2280,7 +2279,7 @@ provider "registry.terraform.io/hashicorp/test" {
|
||||
|
||||
// write input lockfile
|
||||
lockFile := ".terraform.lock.hcl"
|
||||
if err := ioutil.WriteFile(lockFile, []byte(tc.input), 0644); err != nil {
|
||||
if err := os.WriteFile(lockFile, []byte(tc.input), 0644); err != nil {
|
||||
t.Fatalf("failed to write input lockfile: %s", err)
|
||||
}
|
||||
|
||||
@@ -2292,7 +2291,7 @@ provider "registry.terraform.io/hashicorp/test" {
|
||||
t.Fatalf("expected error, got output: \n%s", ui.OutputWriter.String())
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadFile(lockFile)
|
||||
buf, err := os.ReadFile(lockFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read dependency lock file %s: %s", lockFile, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user