diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-03-16 15:33:54 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-03-16 15:37:43 +0100 |
commit | 9a6bfd4ab893cf1ed4c8c1141e4bcad3829decad (patch) | |
tree | 3374ab79b1afae60d10e89c31c2a4092390cf492 /client/go/util/io.go | |
parent | da742fc1e74c0ce8a8724794f42a885bad63f092 (diff) |
Stop using deprecated ioutil functions
Diffstat (limited to 'client/go/util/io.go')
-rw-r--r-- | client/go/util/io.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/client/go/util/io.go b/client/go/util/io.go index 68b50733006..68e855b0c3e 100644 --- a/client/go/util/io.go +++ b/client/go/util/io.go @@ -9,7 +9,6 @@ import ( "encoding/json" "errors" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -43,7 +42,7 @@ func ReaderToBytes(reader io.Reader) []byte { // Returns the contents of reader as indented JSON func ReaderToJSON(reader io.Reader) string { - bodyBytes, _ := ioutil.ReadAll(reader) + bodyBytes, _ := io.ReadAll(reader) var prettyJSON bytes.Buffer parseError := json.Indent(&prettyJSON, bodyBytes, "", " ") if parseError != nil { // Not JSON: Print plainly @@ -55,7 +54,7 @@ func ReaderToJSON(reader io.Reader) string { // AtomicWriteFile atomically writes data to filename. func AtomicWriteFile(filename string, data []byte) error { dir := filepath.Dir(filename) - tmpFile, err := ioutil.TempFile(dir, "vespa") + tmpFile, err := os.CreateTemp(dir, "vespa") if err != nil { return err } |