diff --git a/cmd/stringer/endtoend_test.go b/cmd/stringer/endtoend_test.go index 5b969a52e..268c2f61b 100644 --- a/cmd/stringer/endtoend_test.go +++ b/cmd/stringer/endtoend_test.go @@ -14,7 +14,6 @@ import ( "fmt" "go/build" "io" - "io/ioutil" "os" "os/exec" "path" @@ -113,7 +112,7 @@ func TestTags(t *testing.T) { if err != nil { t.Fatal(err) } - result, err := ioutil.ReadFile(output) + result, err := os.ReadFile(output) if err != nil { t.Fatal(err) } @@ -128,7 +127,7 @@ func TestTags(t *testing.T) { if err != nil { t.Fatal(err) } - result, err = ioutil.ReadFile(output) + result, err = os.ReadFile(output) if err != nil { t.Fatal(err) } @@ -184,7 +183,7 @@ func buildStringer(t *testing.T) (dir string, stringer string) { t.Helper() testenv.NeedsTool(t, "go") - dir, err := ioutil.TempDir("", "stringer") + dir, err := os.MkdirTemp("", "stringer") if err != nil { t.Fatal(err) } diff --git a/cmd/stringer/golden_test.go b/cmd/stringer/golden_test.go index b29763174..2e2ec58de 100644 --- a/cmd/stringer/golden_test.go +++ b/cmd/stringer/golden_test.go @@ -10,7 +10,6 @@ package main import ( - "io/ioutil" "os" "path/filepath" "strings" @@ -452,7 +451,7 @@ func (i Token) String() string { func TestGolden(t *testing.T) { testenv.NeedsTool(t, "go") - dir, err := ioutil.TempDir("", "stringer") + dir, err := os.MkdirTemp("", "stringer") if err != nil { t.Error(err) } @@ -466,7 +465,7 @@ func TestGolden(t *testing.T) { input := "package test\n" + test.input file := test.name + ".go" absFile := filepath.Join(dir, file) - err := ioutil.WriteFile(absFile, []byte(input), 0644) + err := os.WriteFile(absFile, []byte(input), 0644) if err != nil { t.Error(err) } diff --git a/cmd/stringer/stringer.go b/cmd/stringer/stringer.go index b079985b3..998d1a51b 100644 --- a/cmd/stringer/stringer.go +++ b/cmd/stringer/stringer.go @@ -76,7 +76,6 @@ import ( "go/format" "go/token" "go/types" - "io/ioutil" "log" "os" "path/filepath" @@ -166,7 +165,7 @@ func main() { baseName := fmt.Sprintf("%s_string.go", types[0]) outputName = filepath.Join(dir, strings.ToLower(baseName)) } - err := ioutil.WriteFile(outputName, src, 0644) + err := os.WriteFile(outputName, src, 0644) if err != nil { log.Fatalf("writing output: %s", err) }