Merge pull request #2167 from xiaoliwang/remove_deprecated

This commit is contained in:
Jesse Duffield
2022-09-23 23:01:40 -07:00
committed by GitHub
21 changed files with 47 additions and 57 deletions

View File

@@ -1,7 +1,7 @@
package controllers
import (
"io/ioutil"
"os"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/context"
@@ -192,7 +192,7 @@ func (self *MergeConflictsController) HandleUndo() error {
self.c.LogAction("Restoring file to previous state")
self.c.LogCommand("Undoing last conflict resolution", false)
if err := ioutil.WriteFile(state.GetPath(), []byte(state.GetContent()), 0o644); err != nil {
if err := os.WriteFile(state.GetPath(), []byte(state.GetContent()), 0o644); err != nil {
return err
}
@@ -280,7 +280,7 @@ func (self *MergeConflictsController) resolveConflict(selection mergeconflicts.S
self.c.LogAction("Resolve merge conflict")
self.c.LogCommand(logStr, false)
state.PushContent(content)
return true, ioutil.WriteFile(state.GetPath(), []byte(content), 0o644)
return true, os.WriteFile(state.GetPath(), []byte(content), 0o644)
}
func (self *MergeConflictsController) onLastConflictResolved() error {

View File

@@ -2,7 +2,7 @@ package gui
import (
"fmt"
"io/ioutil"
"io"
"log"
"os"
"strings"
@@ -656,8 +656,8 @@ func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error { //nolint:unpara
err := subprocess.Run()
subprocess.Stdout = ioutil.Discard
subprocess.Stderr = ioutil.Discard
subprocess.Stdout = io.Discard
subprocess.Stderr = io.Discard
subprocess.Stdin = nil
if gui.Config.GetUserConfig().PromptToReturnFromSubprocess {

View File

@@ -2,7 +2,6 @@ package gui
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -20,7 +19,7 @@ import (
func (gui *Gui) getCurrentBranch(path string) string {
readHeadFile := func(path string) (string, error) {
headFile, err := ioutil.ReadFile(filepath.Join(path, "HEAD"))
headFile, err := os.ReadFile(filepath.Join(path, "HEAD"))
if err == nil {
content := strings.TrimSpace(string(headFile))
refsPrefix := "ref: refs/heads/"
@@ -47,7 +46,7 @@ func (gui *Gui) getCurrentBranch(path string) string {
}
} else {
// worktree
if worktreeGitDir, err := ioutil.ReadFile(gitDirPath); err == nil {
if worktreeGitDir, err := os.ReadFile(gitDirPath); err == nil {
content := strings.TrimSpace(string(worktreeGitDir))
worktreePath := strings.TrimPrefix(content, "gitdir: ")
if branch, err := readHeadFile(worktreePath); err == nil {

View File

@@ -2,7 +2,6 @@ package gui
import (
"encoding/json"
"io/ioutil"
"log"
"os"
"strconv"
@@ -93,7 +92,7 @@ func GetRecordingSpeed() float64 {
func LoadRecording() (*gocui.Recording, error) {
path := os.Getenv("REPLAY_EVENTS_FROM")
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
@@ -120,5 +119,5 @@ func SaveRecording(recording *gocui.Recording) error {
path := recordEventsTo()
return ioutil.WriteFile(path, jsonEvents, 0o600)
return os.WriteFile(path, jsonEvents, 0o600)
}