summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git_commands')
-rw-r--r--pkg/commands/git_commands/file.go4
-rw-r--r--pkg/commands/git_commands/rebase.go10
-rw-r--r--pkg/commands/git_commands/working_tree_test.go4
3 files changed, 9 insertions, 9 deletions
diff --git a/pkg/commands/git_commands/file.go b/pkg/commands/git_commands/file.go
index 898c26e33..111733bb7 100644
--- a/pkg/commands/git_commands/file.go
+++ b/pkg/commands/git_commands/file.go
@@ -1,7 +1,7 @@
package git_commands
import (
- "io/ioutil"
+ "os"
"strconv"
"github.com/go-errors/errors"
@@ -20,7 +20,7 @@ func NewFileCommands(gitCommon *GitCommon) *FileCommands {
// Cat obtains the content of a file
func (self *FileCommands) Cat(fileName string) (string, error) {
- buf, err := ioutil.ReadFile(fileName)
+ buf, err := os.ReadFile(fileName)
if err != nil {
return "", nil
}
diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go
index 48a613e41..9a8f94618 100644
--- a/pkg/commands/git_commands/rebase.go
+++ b/pkg/commands/git_commands/rebase.go
@@ -2,7 +2,7 @@ package git_commands
import (
"fmt"
- "io/ioutil"
+ "os"
"path/filepath"
"strings"
@@ -202,7 +202,7 @@ func (self *RebaseCommands) AmendTo(sha string) error {
// EditRebaseTodo sets the action at a given index in the git-rebase-todo file
func (self *RebaseCommands) EditRebaseTodo(index int, action string) error {
fileName := filepath.Join(self.dotGitDir, "rebase-merge/git-rebase-todo")
- bytes, err := ioutil.ReadFile(fileName)
+ bytes, err := os.ReadFile(fileName)
if err != nil {
return err
}
@@ -217,7 +217,7 @@ func (self *RebaseCommands) EditRebaseTodo(index int, action string) error {
content[contentIndex] = action + " " + strings.Join(splitLine[1:], " ")
result := strings.Join(content, "\n")
- return ioutil.WriteFile(fileName, []byte(result), 0o644)
+ return os.WriteFile(fileName, []byte(result), 0o644)
}
func (self *RebaseCommands) getTodoCommitCount(content []string) int {
@@ -234,7 +234,7 @@ func (self *RebaseCommands) getTodoCommitCount(content []string) int {
// MoveTodoDown moves a rebase todo item down by one position
func (self *RebaseCommands) MoveTodoDown(index int) error {
fileName := filepath.Join(self.dotGitDir, "rebase-merge/git-rebase-todo")
- bytes, err := ioutil.ReadFile(fileName)
+ bytes, err := os.ReadFile(fileName)
if err != nil {
return err
}
@@ -247,7 +247,7 @@ func (self *RebaseCommands) MoveTodoDown(index int) error {
rearrangedContent = append(rearrangedContent, content[contentIndex+1:]...)
result := strings.Join(rearrangedContent, "\n")
- return ioutil.WriteFile(fileName, []byte(result), 0o644)
+ return os.WriteFile(fileName, []byte(result), 0o644)
}
// SquashAllAboveFixupCommits squashes all fixup! commits above the given one
diff --git a/pkg/commands/git_commands/working_tree_test.go b/pkg/commands/git_commands/working_tree_test.go
index e4e884ce4..049961541 100644
--- a/pkg/commands/git_commands/working_tree_test.go
+++ b/pkg/commands/git_commands/working_tree_test.go
@@ -2,7 +2,7 @@ package git_commands
import (
"fmt"
- "io/ioutil"
+ "os"
"regexp"
"testing"
@@ -432,7 +432,7 @@ func TestWorkingTreeApplyPatch(t *testing.T) {
filename := matches[1]
- content, err := ioutil.ReadFile(filename)
+ content, err := os.ReadFile(filename)
assert.NoError(t, err)
assert.Equal(t, "test", string(content))