Refactor: move from io/ioutil to io and os package (#2234)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <zerjun@beatchain.co>
This commit is contained in:
Eng Zer Jun
2021-09-06 18:33:42 +08:00
committed by GitHub
parent f8ac24db27
commit 426aa7af34
49 changed files with 143 additions and 171 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ package utils
import (
"errors"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
@@ -218,7 +218,7 @@ func TestFixOpenAPISchema(t *testing.T) {
schema := swagger.Components.Schemas[model.ParameterFieldName].Value
fixOpenAPISchema("", schema)
fixedSchema, _ := schema.MarshalJSON()
expectedSchema, _ := ioutil.ReadFile(filepath.Join(TestDir, tc.fixedFile))
expectedSchema, _ := os.ReadFile(filepath.Join(TestDir, tc.fixedFile))
assert.Equal(t, string(fixedSchema), string(expectedSchema))
})
}