diff --git a/arm/armasm/decode_test.go b/arm/armasm/decode_test.go index e2d9127..80e02df 100644 --- a/arm/armasm/decode_test.go +++ b/arm/armasm/decode_test.go @@ -6,14 +6,14 @@ package armasm import ( "encoding/hex" - "io/ioutil" + "os" "strconv" "strings" "testing" ) func TestDecode(t *testing.T) { - data, err := ioutil.ReadFile("testdata/decode.txt") + data, err := os.ReadFile("testdata/decode.txt") if err != nil { t.Fatal(err) } diff --git a/arm/armasm/ext_test.go b/arm/armasm/ext_test.go index f075862..c72ab1b 100644 --- a/arm/armasm/ext_test.go +++ b/arm/armasm/ext_test.go @@ -14,7 +14,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -190,7 +189,7 @@ const start = 0x8000 // start address of text // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "armasm") + f, err = os.CreateTemp("", "armasm") if err != nil { return } @@ -568,7 +567,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { // It only uses the inputs; it ignores the answers recorded in that file. func testdataCases(t *testing.T) func(func([]byte)) { var codes [][]byte - data, err := ioutil.ReadFile("testdata/decode.txt") + data, err := os.ReadFile("testdata/decode.txt") if err != nil { t.Fatal(err) } diff --git a/arm/armspec/specmap.go b/arm/armspec/specmap.go index 973030f..b99586d 100644 --- a/arm/armspec/specmap.go +++ b/arm/armspec/specmap.go @@ -9,7 +9,6 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "log" "os" "regexp" @@ -33,7 +32,7 @@ type Inst struct { } func main() { - data, err := ioutil.ReadFile("spec.json") + data, err := os.ReadFile("spec.json") if err != nil { log.Fatal(err) } diff --git a/arm64/arm64asm/decode_test.go b/arm64/arm64asm/decode_test.go index 26eb6ae..aa13997 100644 --- a/arm64/arm64asm/decode_test.go +++ b/arm64/arm64asm/decode_test.go @@ -6,7 +6,7 @@ package arm64asm import ( "encoding/hex" - "io/ioutil" + "os" "path/filepath" "strings" "testing" @@ -14,7 +14,7 @@ import ( func testDecode(t *testing.T, syntax string) { input := filepath.Join("testdata", syntax+"cases.txt") - data, err := ioutil.ReadFile(input) + data, err := os.ReadFile(input) if err != nil { t.Fatal(err) } diff --git a/arm64/arm64asm/ext_test.go b/arm64/arm64asm/ext_test.go index f0d18e9..362276a 100644 --- a/arm64/arm64asm/ext_test.go +++ b/arm64/arm64asm/ext_test.go @@ -15,7 +15,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -214,7 +213,7 @@ const start = 0x8000 // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "arm64asm") + f, err = os.CreateTemp("", "arm64asm") if err != nil { return } @@ -501,7 +500,7 @@ func doFuzzy(inst *InstJson, Ninst int) { // JSONCases generates ARM64 instructions according to inst.json. func JSONCases(t *testing.T) func(func([]byte)) { return func(try func([]byte)) { - data, err := ioutil.ReadFile("inst.json") + data, err := os.ReadFile("inst.json") if err != nil { t.Fatal(err) } @@ -565,7 +564,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { func testdataCases(t *testing.T, syntax string) func(func([]byte)) { var codes [][]byte input := filepath.Join("testdata", syntax+"cases.txt") - data, err := ioutil.ReadFile(input) + data, err := os.ReadFile(input) if err != nil { t.Fatal(err) } diff --git a/arm64/arm64gen/sysreggen.go b/arm64/arm64gen/sysreggen.go index 5c42532..dd83f23 100644 --- a/arm64/arm64gen/sysreggen.go +++ b/arm64/arm64gen/sysreggen.go @@ -22,7 +22,7 @@ import ( "encoding/xml" "flag" "fmt" - "io/ioutil" + "io" "log" "os" "path/filepath" @@ -124,7 +124,7 @@ func main() { check(err) defer out.Close() - files, err := ioutil.ReadDir(*xmlfolder) + files, err := os.ReadDir(*xmlfolder) check(err) var systemregs []SystemReg @@ -133,7 +133,7 @@ func main() { for _, file := range files { xmlFile, err := os.Open(filepath.Join(*xmlfolder, file.Name())) check(err) - value, err := ioutil.ReadAll(xmlFile) + value, err := io.ReadAll(xmlFile) check(err) var regpage RegisterPage diff --git a/loong64/loong64asm/decode_test.go b/loong64/loong64asm/decode_test.go index 74a3277..e485cb8 100644 --- a/loong64/loong64asm/decode_test.go +++ b/loong64/loong64asm/decode_test.go @@ -6,7 +6,7 @@ package loong64asm import ( "encoding/hex" - "io/ioutil" + "os" "path/filepath" "strings" "testing" @@ -14,7 +14,7 @@ import ( func testDecode(t *testing.T, syntax string) { input := filepath.Join("testdata", syntax+"cases.txt") - data, err := ioutil.ReadFile(input) + data, err := os.ReadFile(input) if err != nil { t.Fatal(err) } diff --git a/loong64/loong64asm/ext_test.go b/loong64/loong64asm/ext_test.go index 5e73c80..14235c6 100644 --- a/loong64/loong64asm/ext_test.go +++ b/loong64/loong64asm/ext_test.go @@ -13,7 +13,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -187,7 +186,7 @@ const start = 0x8000 // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "loong64asm") + f, err = os.CreateTemp("", "loong64asm") if err != nil { return } @@ -371,7 +370,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { func testdataCases(t *testing.T, syntax string) func(func([]byte)) { var codes [][]byte input := filepath.Join("testdata", syntax+"cases.txt") - data, err := ioutil.ReadFile(input) + data, err := os.ReadFile(input) if err != nil { t.Fatal(err) } diff --git a/ppc64/ppc64asm/decode_test.go b/ppc64/ppc64asm/decode_test.go index 83a3acd..4fda8ec 100644 --- a/ppc64/ppc64asm/decode_test.go +++ b/ppc64/ppc64asm/decode_test.go @@ -7,14 +7,14 @@ package ppc64asm import ( "encoding/binary" "encoding/hex" - "io/ioutil" + "os" "path" "strings" "testing" ) func TestDecode(t *testing.T) { - files, err := ioutil.ReadDir("testdata") + files, err := os.ReadDir("testdata") if err != nil { t.Fatal(err) } @@ -23,7 +23,7 @@ func TestDecode(t *testing.T) { continue } filename := path.Join("testdata", f.Name()) - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { t.Fatal(err) } diff --git a/ppc64/ppc64asm/ext_test.go b/ppc64/ppc64asm/ext_test.go index 806701b..60428e6 100644 --- a/ppc64/ppc64asm/ext_test.go +++ b/ppc64/ppc64asm/ext_test.go @@ -15,7 +15,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -188,7 +187,7 @@ const start = 0x8000 // start address of text // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "ppc64asm") + f, err = os.CreateTemp("", "ppc64asm") if err != nil { return } @@ -494,7 +493,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { // It only uses the inputs; it ignores the answers recorded in that file. func testdataCases(t *testing.T) func(func([]byte)) { var codes [][]byte - data, err := ioutil.ReadFile("testdata/decode.txt") + data, err := os.ReadFile("testdata/decode.txt") if err != nil { t.Fatal(err) } diff --git a/riscv64/riscv64asm/ext_test.go b/riscv64/riscv64asm/ext_test.go index 556cd01..c2e35ef 100644 --- a/riscv64/riscv64asm/ext_test.go +++ b/riscv64/riscv64asm/ext_test.go @@ -13,7 +13,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -189,7 +188,7 @@ const start = 0x8000 // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "riscv64asm") + f, err = os.CreateTemp("", "riscv64asm") if err != nil { return } @@ -299,7 +298,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { func testdataCases(t *testing.T, syntax string) func(func([]byte)) { var codes [][]byte input := filepath.Join("testdata", syntax+"cases.txt") - data, err := ioutil.ReadFile(input) + data, err := os.ReadFile(input) if err != nil { t.Fatal(err) } diff --git a/s390x/s390xasm/decode_test.go b/s390x/s390xasm/decode_test.go index 047ebee..51dd5e7 100644 --- a/s390x/s390xasm/decode_test.go +++ b/s390x/s390xasm/decode_test.go @@ -6,14 +6,14 @@ package s390xasm import ( "encoding/hex" - "io/ioutil" + "os" "path" "strings" "testing" ) func TestDecode(t *testing.T) { - files, err := ioutil.ReadDir("testdata") + files, err := os.ReadDir("testdata") if err != nil { t.Fatal(err) } @@ -22,7 +22,7 @@ func TestDecode(t *testing.T) { continue } filename := path.Join("testdata", f.Name()) - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { t.Fatal(err) } diff --git a/x86/x86asm/decode_test.go b/x86/x86asm/decode_test.go index 4543cd2..559556d 100644 --- a/x86/x86asm/decode_test.go +++ b/x86/x86asm/decode_test.go @@ -6,14 +6,14 @@ package x86asm import ( "encoding/hex" - "io/ioutil" + "os" "strconv" "strings" "testing" ) func TestDecode(t *testing.T) { - data, err := ioutil.ReadFile("testdata/decode.txt") + data, err := os.ReadFile("testdata/decode.txt") if err != nil { t.Fatal(err) } diff --git a/x86/x86asm/ext_test.go b/x86/x86asm/ext_test.go index 2e31dd3..d198da8 100644 --- a/x86/x86asm/ext_test.go +++ b/x86/x86asm/ext_test.go @@ -13,7 +13,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "math/rand" "os" @@ -193,7 +192,7 @@ const start = 0x8000 // start address of text // starting at offset start. That file is intended to be the input to // the external disassembler. func writeInst(generate func(func([]byte))) (file string, f *os.File, size int, err error) { - f, err = ioutil.TempFile("", "x86map") + f, err = os.CreateTemp("", "x86map") if err != nil { return } @@ -524,7 +523,7 @@ func hexCases(t *testing.T, encoded string) func(func([]byte)) { // It only uses the inputs; it ignores the answers recorded in that file. func testdataCases(t *testing.T) func(func([]byte)) { var codes [][]byte - data, err := ioutil.ReadFile("testdata/decode.txt") + data, err := os.ReadFile("testdata/decode.txt") if err != nil { t.Fatal(err) } diff --git a/x86/x86avxgen/avxgen_test.go b/x86/x86avxgen/avxgen_test.go index e2f5b24..b1a9b76 100644 --- a/x86/x86avxgen/avxgen_test.go +++ b/x86/x86avxgen/avxgen_test.go @@ -6,7 +6,7 @@ package main import ( "bytes" - "io/ioutil" + "os" "path/filepath" "regexp" "strings" @@ -57,7 +57,7 @@ func TestOutput(t *testing.T) { var testCases []testCase { opcodeRE := regexp.MustCompile(`as: ([A-Z][A-Z0-9]*)`) - data, err := ioutil.ReadFile(filepath.Join("testdata", "golden.txt")) + data, err := os.ReadFile(filepath.Join("testdata", "golden.txt")) if err != nil { t.Fatalf("read golden file: %v", err) } diff --git a/x86/xeddata/database.go b/x86/xeddata/database.go index a6ec760..fa08d2f 100644 --- a/x86/xeddata/database.go +++ b/x86/xeddata/database.go @@ -9,7 +9,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" "regexp" @@ -212,7 +211,7 @@ func (db *Database) WidthSize(width string, m OperandSizeMode) string { } func parseWidths(r io.Reader) (map[string]*width, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("parse widths: %v", err) } @@ -282,7 +281,7 @@ func parseExtraWidths(r io.Reader) (map[string]string, error) { } func parseStates(r io.Reader) (map[string]string, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("parse states: %v", err) } @@ -303,7 +302,7 @@ func parseStates(r io.Reader) (map[string]string, error) { } func parseXtypes(r io.Reader) (map[string]*xtype, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("parse xtypes: %v", err) } diff --git a/x86/xeddata/xeddata_test.go b/x86/xeddata/xeddata_test.go index 8b64be4..6d05ee9 100644 --- a/x86/xeddata/xeddata_test.go +++ b/x86/xeddata/xeddata_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" + "os" "path" "reflect" "strings" @@ -401,7 +401,7 @@ func TestReader(t *testing.T) { var tests []test { - b, err := ioutil.ReadFile(path.Join("testdata", "xed_objects.txt")) + b, err := os.ReadFile(path.Join("testdata", "xed_objects.txt")) if err != nil { t.Fatal(err) }