Skip to content

Commit f2a7fa7

Browse files
committed
Fix ioutil deprecation
1 parent b31c863 commit f2a7fa7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"io/ioutil"
4+
"os"
55

66
"github.com/miekg/dns"
77
"gopkg.in/yaml.v3"
@@ -21,7 +21,7 @@ type ServerDefinition struct {
2121
}
2222

2323
func (s *Config) Load(configfile string) *Config {
24-
data, err := ioutil.ReadFile(configfile)
24+
data, err := os.ReadFile(configfile)
2525
if err != nil {
2626
panic(err)
2727
}

state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"encoding/json"
5-
"io/ioutil"
5+
"os"
66
)
77

88
type State struct {
@@ -21,7 +21,7 @@ func NewState(fname string) *State {
2121
}
2222

2323
func (s *State) Load() *State {
24-
data, _ := ioutil.ReadFile(s.filename)
24+
data, _ := os.ReadFile(s.filename)
2525
json.Unmarshal(data, &s)
2626
return s
2727
}
@@ -32,7 +32,7 @@ func (s *State) Save() {
3232
}
3333
s.writeRequired = false
3434
jsonString, _ := json.Marshal(s)
35-
ioutil.WriteFile(s.filename, jsonString, 0644)
35+
os.WriteFile(s.filename, jsonString, 0644)
3636
}
3737

3838
func (s *State) SetMaxId(maxid int) *State {

0 commit comments

Comments
 (0)