Skip to content

Commit

Permalink
Appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Oct 10, 2023
1 parent 39e694f commit 2dda39d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pkg/commands/dummies.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package commands

import (
"io/ioutil"
"io"

"github.com/jesseduffield/lazydocker/pkg/config"
"github.com/jesseduffield/lazydocker/pkg/i18n"
Expand Down Expand Up @@ -31,7 +31,7 @@ func NewDummyAppConfig() *config.AppConfig {
// NewDummyLog creates a new dummy Log for testing
func NewDummyLog() *logrus.Entry {
log := logrus.New()
log.Out = ioutil.Discard
log.Out = io.Discard
return log.WithField("test", "test")
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package commands
import (
"context"
"fmt"
"io/ioutil"
"io"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -240,7 +240,7 @@ func (c *OSCommand) AppendLineToFile(filename, line string) error {

// CreateTempFile writes a string to a new temp file and returns the file's name
func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
tmpfile, err := ioutil.TempFile("", filename)
tmpfile, err := os.CreateTemp("", filename)
if err != nil {
c.Log.Error(err)
return "", WrapError(err)
Expand Down Expand Up @@ -342,7 +342,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))
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/commands/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package commands

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -290,7 +289,7 @@ func TestOSCommandCreateTempFile(t *testing.T) {
func(path string, err error) {
assert.NoError(t, err)

content, err := ioutil.ReadFile(path)
content, err := os.ReadFile(path)
assert.NoError(t, err)

assert.Equal(t, "content", string(content))
Expand Down
3 changes: 1 addition & 2 deletions pkg/commands/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net"
"net/url"
"os"
Expand Down Expand Up @@ -37,7 +36,7 @@ func NewSSHHandler(oSCommand CmdKiller) *SSHHandler {
return (&net.Dialer{}).DialContext(ctx, network, addr)
},
startCmd: func(cmd *exec.Cmd) error { return cmd.Start() },
tempDir: ioutil.TempDir,
tempDir: os.MkdirTemp,
getenv: os.Getenv,
setenv: os.Setenv,
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package config

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -569,7 +568,7 @@ func loadUserConfig(configDir string, base *UserConfig) (*UserConfig, error) {
}
}

content, err := ioutil.ReadFile(fileName)
content, err := os.ReadFile(fileName)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/gui/subprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gui

import (
"fmt"
"io/ioutil"
"io"
"os"
"os/exec"
"os/signal"
Expand Down Expand Up @@ -65,8 +65,8 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
}

cmd.Stdin = nil
cmd.Stdout = ioutil.Discard
cmd.Stderr = ioutil.Discard
cmd.Stdout = io.Discard
cmd.Stderr = io.Discard

gui.promptToReturn()
}
4 changes: 2 additions & 2 deletions pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package log

import (
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"

Expand Down Expand Up @@ -54,7 +54,7 @@ func newDevelopmentLogger(config *config.AppConfig) *logrus.Logger {

func newProductionLogger() *logrus.Logger {
log := logrus.New()
log.Out = ioutil.Discard
log.Out = io.Discard
log.SetLevel(logrus.ErrorLevel)
return log
}

0 comments on commit 2dda39d

Please sign in to comment.