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 committed Jul 19, 2023
1 parent a6ff68f commit ed47ece
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/remotemobprogramming/mob/v4/help"
"github.com/remotemobprogramming/mob/v4/open"
"github.com/remotemobprogramming/mob/v4/say"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -764,7 +764,7 @@ func sendRequest(requestBody []byte, requestMethod string, requestUrl string, di
return fmt.Errorf("failed to make the http request: %w", responseErr)
}
defer response.Body.Close()
body, responseReadingErr := ioutil.ReadAll(response.Body)
body, responseReadingErr := io.ReadAll(response.Body)
if responseReadingErr != nil {
return fmt.Errorf("failed to read the http response: %w", responseReadingErr)
}
Expand Down
3 changes: 1 addition & 2 deletions mob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/remotemobprogramming/mob/v4/open"
"github.com/remotemobprogramming/mob/v4/say"
"github.com/remotemobprogramming/mob/v4/test"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -2044,7 +2043,7 @@ func createFile(t *testing.T, filename string, content string) (pathToFile strin
func createFileInPath(t *testing.T, path, filename, content string) (pathToFile string) {
contentAsBytes := []byte(content)
pathToFile = path + "/" + filename
err := ioutil.WriteFile(pathToFile, contentAsBytes, 0644)
err := os.WriteFile(pathToFile, contentAsBytes, 0644)
if err != nil {
failWithFailure(t, "creating file "+filename+" with content "+content, "error")
}
Expand Down
3 changes: 1 addition & 2 deletions squash_wip.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
config "github.com/remotemobprogramming/mob/v4/configuration"
"github.com/remotemobprogramming/mob/v4/say"
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -104,7 +103,7 @@ func squashWipGitSequenceEditor(fileName string, configuration config.Configurat

func replaceFileContents(fileName string, replacer Replacer) {
file, _ := os.OpenFile(fileName, os.O_RDWR, 0666)
input, err := ioutil.ReadAll(file)
input, err := io.ReadAll(file)
if err != nil {
panic(err)
}
Expand Down
5 changes: 2 additions & 3 deletions squash_wip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
config "github.com/remotemobprogramming/mob/v4/configuration"
"io/ioutil"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -405,7 +404,7 @@ new file

squashWipGitEditor(input, config.GetDefaultConfiguration())

result, _ := ioutil.ReadFile(input)
result, _ := os.ReadFile(input)
equals(t, expected, string(result))
}

Expand All @@ -431,7 +430,7 @@ squash c51a56d manual commit

squashWipGitSequenceEditor(input, config.GetDefaultConfiguration())

result, _ := ioutil.ReadFile(input)
result, _ := os.ReadFile(input)
equals(t, expected, string(result))
}

Expand Down
4 changes: 2 additions & 2 deletions test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package test
import (
"fmt"
"github.com/remotemobprogramming/mob/v4/say"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"runtime"
Expand Down Expand Up @@ -44,7 +44,7 @@ func failWithFailureMessage(t *testing.T, message string) {
func CreateFile(t *testing.T, filename string, content string) (pathToFile string) {
contentAsBytes := []byte(content)
pathToFile = workingDir + "/" + filename
err := ioutil.WriteFile(pathToFile, contentAsBytes, 0644)
err := os.WriteFile(pathToFile, contentAsBytes, 0644)
if err != nil {
failWithFailure(t, "creating file "+filename+" with content "+content, "error")
}
Expand Down

0 comments on commit ed47ece

Please sign in to comment.