refactor: move from io/ioutil to io and os packages

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2021-11-25 12:09:23 +08:00
parent ae341be638
commit ef8d7d2fd7
26 changed files with 73 additions and 89 deletions

View File

@@ -3,7 +3,6 @@ package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@@ -124,7 +123,7 @@ func (s *SystemHelper) setup() error {
if err != nil {
return err
}
err = ioutil.WriteFile(s.wailsSystemConfig, configData, 0755)
err = os.WriteFile(s.wailsSystemConfig, configData, 0755)
if err != nil {
return err
}
@@ -207,11 +206,11 @@ func (sc *SystemConfig) Save(filename string) error {
}
// Write it out to the config file
return ioutil.WriteFile(filename, theJSON, 0644)
return os.WriteFile(filename, theJSON, 0644)
}
func (sc *SystemConfig) load(filename string) error {
configData, err := ioutil.ReadFile(filename)
configData, err := os.ReadFile(filename)
if err != nil {
return err
}