Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove refs to deprecated io/ioutil #123

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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