Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored and saniales committed Jul 26, 2023
1 parent 7ff9355 commit 217cf51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package bot

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

yaml "gopkg.in/yaml.v2"

Expand Down Expand Up @@ -47,7 +47,7 @@ func executeInitCommand(cmd *cobra.Command, args []string) {
func initConfig() {
if initFlags.ConfigFile != "" {
//try first to unmarshal the file to check if it is correct format.
content, err := ioutil.ReadFile(initFlags.ConfigFile)
content, err := os.ReadFile(initFlags.ConfigFile)
if err != nil {
fmt.Print("Error while opening the config file provided")
if GlobalFlags.Verbose > 0 {
Expand All @@ -66,7 +66,7 @@ func initConfig() {
fmt.Println()
return
}
err = ioutil.WriteFile("./.bot_config.yml", content, 0666)
err = os.WriteFile("./.bot_config.yml", content, 0666)
if err != nil {
fmt.Print("Cannot write new configuration file")
if GlobalFlags.Verbose > 0 {
Expand Down Expand Up @@ -190,7 +190,7 @@ func generateInitFile() {
fmt.Scanln(&YesNo)
}
if YesNo == "Y" {
err := ioutil.WriteFile("./.gobot", contentToBeWritten, 0666)
err := os.WriteFile("./.gobot", contentToBeWritten, 0666)
if err != nil {
fmt.Print("Error while writing content to new config file")
if GlobalFlags.Verbose > 0 {
Expand Down
4 changes: 2 additions & 2 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package bot

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

Expand Down Expand Up @@ -50,7 +50,7 @@ func initConfigs() error {
if err != nil {
return err
}
contentToMarshal, err := ioutil.ReadAll(configFile)
contentToMarshal, err := io.ReadAll(configFile)
if err != nil {
return err
}
Expand Down

0 comments on commit 217cf51

Please sign in to comment.