From 0c2d125f378093ed470d17aeeec3efd4ca747aea Mon Sep 17 00:00:00 2001 From: Danil Suetin Date: Sun, 24 Nov 2024 18:26:56 +0100 Subject: [PATCH] remove deprecated io/ioutil --- jsonc.go | 4 ++-- jsonc_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/jsonc.go b/jsonc.go index 12c2dfb..745bc65 100644 --- a/jsonc.go +++ b/jsonc.go @@ -24,7 +24,7 @@ package jsonc import ( "encoding/json" - "io/ioutil" + "os" ) // ToJSON returns JSON equivalent of JSON with comments @@ -34,7 +34,7 @@ func ToJSON(b []byte) []byte { // ReadFromFile reads jsonc file and returns JSONC and JSON encodings func ReadFromFile(filename string) ([]byte, []byte, error) { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return nil, nil, err } diff --git a/jsonc_test.go b/jsonc_test.go index ad980d0..b295b49 100644 --- a/jsonc_test.go +++ b/jsonc_test.go @@ -2,7 +2,6 @@ package jsonc import ( "encoding/json" - "io/ioutil" "os" "reflect" "testing" @@ -115,7 +114,7 @@ func TestUnmarshal(t *testing.T) { } func TestReadFromFile(t *testing.T) { - tmp, err := ioutil.TempFile("", "ReadFromFileTest") + tmp, err := os.CreateTemp("", "ReadFromFileTest") if err != nil { t.Skip("Unable to create temp file.", err) }