Skip to content

Commit

Permalink
fix(cmd): using os.WriteFile due to ioutil.WriteFile is deprecate…
Browse files Browse the repository at this point in the history
…d + using mode perm
  • Loading branch information
luisnquin committed Feb 3, 2024
1 parent 760aacf commit a2c2cf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions internal/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
"io/ioutil"
"os"
"time"

Expand Down Expand Up @@ -84,7 +83,7 @@ func (c *NewCmd) Main() cobra.PositionalArgs {
return err
}

err = ioutil.WriteFile(path, []byte(note.Content), 0o644)
err = os.WriteFile(path, []byte(note.Content), os.ModePerm)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"runtime"

Expand Down Expand Up @@ -150,5 +149,5 @@ func (c *App) save() error {
return fmt.Errorf("unexpected error, cannot encode config to json: %w", err)
}

return ioutil.WriteFile(c.FS.GetConfigFile(), content, internal.PermReadWrite)
return os.WriteFile(c.FS.GetConfigFile(), content, internal.PermReadWrite)
}

0 comments on commit a2c2cf6

Please sign in to comment.