mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-19 00:28:03 +02:00
remove deprecated calls
This commit is contained in:
@ -1,10 +1,8 @@
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"io"
|
||||
)
|
||||
|
||||
// this struct captures some IO stuff
|
||||
@ -45,7 +43,7 @@ func NewNullGuiIO(log *logrus.Entry) *guiIO {
|
||||
return &guiIO{
|
||||
log: log,
|
||||
logCommandFn: func(string, bool) {},
|
||||
newCmdWriterFn: func() io.Writer { return ioutil.Discard },
|
||||
newCmdWriterFn: func() io.Writer { return io.Discard },
|
||||
promptForCredentialFn: failPromptFn,
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package oscommands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -151,7 +151,7 @@ func (c *OSCommand) CreateFileWithContent(path string, content string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(path, []byte(content), 0o644); err != nil {
|
||||
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
|
||||
c.Log.Error(err)
|
||||
return utils.WrapError(err)
|
||||
}
|
||||
@ -215,7 +215,7 @@ func (c *OSCommand) PipeCommands(commandStrings ...string) error {
|
||||
c.Log.Error(err)
|
||||
}
|
||||
|
||||
if b, err := ioutil.ReadAll(stderr); err == nil {
|
||||
if b, err := io.ReadAll(stderr); err == nil {
|
||||
if len(b) > 0 {
|
||||
finalErrors = append(finalErrors, string(b))
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -149,7 +148,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
||||
{
|
||||
filepath.Join(os.TempDir(), "testFile"),
|
||||
func(path string) {
|
||||
if err := ioutil.WriteFile(path, []byte("hello"), 0o600); err != nil {
|
||||
if err := os.WriteFile(path, []byte("hello"), 0o600); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
},
|
||||
@ -160,7 +159,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
||||
{
|
||||
filepath.Join(os.TempDir(), "emptyTestFile"),
|
||||
func(path string) {
|
||||
if err := ioutil.WriteFile(path, []byte(""), 0o600); err != nil {
|
||||
if err := os.WriteFile(path, []byte(""), 0o600); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
},
|
||||
@ -171,7 +170,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
||||
{
|
||||
filepath.Join(os.TempDir(), "testFileWithNewline"),
|
||||
func(path string) {
|
||||
if err := ioutil.WriteFile(path, []byte("hello\n"), 0o600); err != nil {
|
||||
if err := os.WriteFile(path, []byte("hello\n"), 0o600); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
},
|
||||
@ -187,7 +186,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
||||
if err := osCommand.AppendLineToFile(s.path, "world"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
f, err := ioutil.ReadFile(s.path)
|
||||
f, err := os.ReadFile(s.path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user