internal/builtin: deprecate io/ioutil (#314)

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
Lars Lehtonen 2023-09-06 13:21:30 -07:00 committed by GitHub
parent 3b589ff6b2
commit 10e1b10d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 6 deletions

View File

@ -7,7 +7,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"github.com/mitchellh/go-homedir"
@ -132,7 +131,7 @@ func getSrc(v cty.Value) (string, bool, error) {
switch {
case !content.IsNull():
file, err := ioutil.TempFile("", "tf-file-content")
file, err := os.CreateTemp("", "tf-file-content")
if err != nil {
return "", true, err
}

View File

@ -5,7 +5,6 @@ package localexec
import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
@ -38,7 +37,7 @@ func TestResourceProvider_Apply(t *testing.T) {
}
// Check the file
raw, err := ioutil.ReadFile("test_out")
raw, err := os.ReadFile("test_out")
if err != nil {
t.Fatalf("err: %v", err)
}

View File

@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
@ -182,7 +181,7 @@ func collectScripts(v cty.Value) ([]io.ReadCloser, error) {
var r []io.ReadCloser
for _, script := range scripts {
r = append(r, ioutil.NopCloser(bytes.NewReader([]byte(script))))
r = append(r, io.NopCloser(bytes.NewReader([]byte(script))))
}
return r, nil