Skip to content

Commit

Permalink
Move away from ioutil now that it is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed Sep 13, 2022
1 parent 1b5ff30 commit 256a116
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/zed/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"strings"

Expand Down Expand Up @@ -142,7 +142,7 @@ func schemaWriteCmdFunc(cmd *cobra.Command, args []string) error {
}
log.Trace().Str("schema", string(schemaBytes)).Str("file", args[0]).Msg("read schema from file")
case 0:
schemaBytes, err = ioutil.ReadAll(os.Stdin)
schemaBytes, err = io.ReadAll(os.Stdin)
if err != nil {
return fmt.Errorf("failed to read schema file: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions internal/storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package storage
import (
"encoding/json"
"errors"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -137,7 +136,7 @@ func (s JSONConfigStore) Put(cfg Config) error {
// at the following URL:
// https://github.com/tailscale/tailscale/blob/main/LICENSE
func atomicWriteFile(filename string, data []byte, perm os.FileMode) (err error) {
f, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename)+".tmp")
f, err := os.CreateTemp(filepath.Dir(filename), filepath.Base(filename)+".tmp")
if err != nil {
return err
}
Expand Down

0 comments on commit 256a116

Please sign in to comment.