Skip to content

Commit

Permalink
Issue #44 - ioutil.ReadFile and ioutil.WriteFile are deprecated
Browse files Browse the repository at this point in the history
- Convert to `os` package versions of the calls.
  • Loading branch information
sprak3000 committed Oct 3, 2023
1 parent 1c24399 commit 0ca7237
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions configuration/reader.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Package configuration handles reading and writing the configuration file for the plugin
package configuration

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

// Reader provides the requirements for anyone implementing reading configuration files from disk
type Reader interface {
Expand All @@ -14,5 +16,5 @@ type FileReader struct {

// ReadFile allows us to read configuration off of disk
func (fr FileReader) ReadFile(filename string) ([]byte, error) {
return ioutil.ReadFile(filename)
return os.ReadFile(filename)
}
5 changes: 3 additions & 2 deletions configuration/writer.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Package configuration handles reading and writing the configuration file for the plugin
package configuration

import (
"io/fs"
"io/ioutil"
"os"
)

// Writer provides the requirements for anyone implementing writing configuration files to disk
Expand All @@ -16,5 +17,5 @@ type FileWriter struct {

// WriteFile allows us to write configuration to disk
func (w FileWriter) WriteFile(filename string, data []byte, perm fs.FileMode) error {
return ioutil.WriteFile(filename, data, perm)
return os.WriteFile(filename, data, perm)
}

0 comments on commit 0ca7237

Please sign in to comment.