1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

remove deprecated calls

This commit is contained in:
jiepeng
2022-09-13 18:11:03 +08:00
committed by Jesse Duffield
parent c81333fefe
commit b8900baf1a
21 changed files with 48 additions and 59 deletions

View File

@ -2,7 +2,6 @@ package components
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -38,7 +37,7 @@ func (s *Shell) RunCommand(cmdStr string) *Shell {
func (s *Shell) CreateFile(path string, content string) *Shell {
fullPath := filepath.Join(s.dir, path)
err := ioutil.WriteFile(fullPath, []byte(content), 0o644)
err := os.WriteFile(fullPath, []byte(content), 0o644)
if err != nil {
panic(fmt.Sprintf("error creating file: %s\n%s", fullPath, err))
}
@ -48,7 +47,7 @@ func (s *Shell) CreateFile(path string, content string) *Shell {
func (s *Shell) UpdateFile(path string, content string) *Shell {
fullPath := filepath.Join(s.dir, path)
err := ioutil.WriteFile(fullPath, []byte(content), 0o644)
err := os.WriteFile(fullPath, []byte(content), 0o644)
if err != nil {
panic(fmt.Sprintf("error updating file: %s\n%s", fullPath, err))
}

View File

@ -168,7 +168,7 @@ func (self *Snapshotter) compareSnapshots() error {
if expectedRepo != actualRepo {
// get the log file and print it
bytes, err := ioutil.ReadFile(filepath.Join(self.paths.Config(), "development.log"))
bytes, err := os.ReadFile(filepath.Join(self.paths.Config(), "development.log"))
if err != nil {
return err
}
@ -250,7 +250,7 @@ func generateSnapshot(dir string) (string, error) {
return nil
}
bytes, err := ioutil.ReadFile(path)
bytes, err := os.ReadFile(path)
if err != nil {
return err
}