Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated io/ioutil #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jsonc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package jsonc

import (
"encoding/json"
"io/ioutil"
"os"
)

// ToJSON returns JSON equivalent of JSON with comments
Expand All @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions jsonc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package jsonc

import (
"encoding/json"
"io/ioutil"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -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)
}
Expand Down