Skip to content

Commit be281c7

Browse files
committed
remove depracecated io/ioutil package
1 parent 06c05ca commit be281c7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

main.go

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

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
87
"path/filepath"
@@ -101,7 +100,7 @@ func hasStr(slice []string, s string) bool {
101100
}
102101

103102
func loadConfig(file string) Config {
104-
data, err := ioutil.ReadFile(file)
103+
data, err := os.ReadFile(file)
105104
if err != nil {
106105
log.Fatalln(err)
107106
}
@@ -177,7 +176,7 @@ func writeJsonnet(to, data string) error {
177176
return fmt.Errorf("%s: %s", err, data)
178177
}
179178

180-
return ioutil.WriteFile(to, []byte(s), 0644)
179+
return os.WriteFile(to, []byte(s), 0644)
181180
}
182181

183182
func copyDirLibsonnet(dir, to string) ([]string, error) {
@@ -199,14 +198,14 @@ func copyDirLibsonnet(dir, to string) ([]string, error) {
199198
})
200199

201200
for _, a := range adds {
202-
content, err := ioutil.ReadFile(a)
201+
content, err := os.ReadFile(a)
203202
if err != nil {
204203
return nil, err
205204
}
206205

207206
a = filepath.Join(to, filepath.Base(a))
208207
os.MkdirAll(filepath.Dir(a), os.ModePerm)
209-
if err := ioutil.WriteFile(a, content, 0644); err != nil {
208+
if err := os.WriteFile(a, content, 0644); err != nil {
210209
return nil, err
211210
}
212211
}

0 commit comments

Comments
 (0)