Skip to content

Commit 2dda39d

Browse files
committed
Appease linter
1 parent 39e694f commit 2dda39d

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

pkg/commands/dummies.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package commands
22

33
import (
4-
"io/ioutil"
4+
"io"
55

66
"github.com/jesseduffield/lazydocker/pkg/config"
77
"github.com/jesseduffield/lazydocker/pkg/i18n"
@@ -31,7 +31,7 @@ func NewDummyAppConfig() *config.AppConfig {
3131
// NewDummyLog creates a new dummy Log for testing
3232
func NewDummyLog() *logrus.Entry {
3333
log := logrus.New()
34-
log.Out = ioutil.Discard
34+
log.Out = io.Discard
3535
return log.WithField("test", "test")
3636
}
3737

pkg/commands/os.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package commands
33
import (
44
"context"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"os"
88
"os/exec"
99
"path/filepath"
@@ -240,7 +240,7 @@ func (c *OSCommand) AppendLineToFile(filename, line string) error {
240240

241241
// CreateTempFile writes a string to a new temp file and returns the file's name
242242
func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
243-
tmpfile, err := ioutil.TempFile("", filename)
243+
tmpfile, err := os.CreateTemp("", filename)
244244
if err != nil {
245245
c.Log.Error(err)
246246
return "", WrapError(err)
@@ -342,7 +342,7 @@ func (c *OSCommand) PipeCommands(commandStrings ...string) error {
342342
c.Log.Error(err)
343343
}
344344

345-
if b, err := ioutil.ReadAll(stderr); err == nil {
345+
if b, err := io.ReadAll(stderr); err == nil {
346346
if len(b) > 0 {
347347
finalErrors = append(finalErrors, string(b))
348348
}

pkg/commands/os_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package commands
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"os"
76
"os/exec"
87
"testing"
@@ -290,7 +289,7 @@ func TestOSCommandCreateTempFile(t *testing.T) {
290289
func(path string, err error) {
291290
assert.NoError(t, err)
292291

293-
content, err := ioutil.ReadFile(path)
292+
content, err := os.ReadFile(path)
294293
assert.NoError(t, err)
295294

296295
assert.Equal(t, "content", string(content))

pkg/commands/ssh/ssh.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"net"
98
"net/url"
109
"os"
@@ -37,7 +36,7 @@ func NewSSHHandler(oSCommand CmdKiller) *SSHHandler {
3736
return (&net.Dialer{}).DialContext(ctx, network, addr)
3837
},
3938
startCmd: func(cmd *exec.Cmd) error { return cmd.Start() },
40-
tempDir: ioutil.TempDir,
39+
tempDir: os.MkdirTemp,
4140
getenv: os.Getenv,
4241
setenv: os.Setenv,
4342
}

pkg/config/app_config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
package config
1414

1515
import (
16-
"io/ioutil"
1716
"os"
1817
"path/filepath"
1918
"strings"
@@ -569,7 +568,7 @@ func loadUserConfig(configDir string, base *UserConfig) (*UserConfig, error) {
569568
}
570569
}
571570

572-
content, err := ioutil.ReadFile(fileName)
571+
content, err := os.ReadFile(fileName)
573572
if err != nil {
574573
return nil, err
575574
}

pkg/gui/subprocess.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package gui
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"os"
77
"os/exec"
88
"os/signal"
@@ -65,8 +65,8 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
6565
}
6666

6767
cmd.Stdin = nil
68-
cmd.Stdout = ioutil.Discard
69-
cmd.Stderr = ioutil.Discard
68+
cmd.Stdout = io.Discard
69+
cmd.Stderr = io.Discard
7070

7171
gui.promptToReturn()
7272
}

pkg/log/log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package log
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"os"
77
"path/filepath"
88

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

5555
func newProductionLogger() *logrus.Logger {
5656
log := logrus.New()
57-
log.Out = ioutil.Discard
57+
log.Out = io.Discard
5858
log.SetLevel(logrus.ErrorLevel)
5959
return log
6060
}

0 commit comments

Comments
 (0)