mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Appease linter
This commit is contained in:
parent
39e694f496
commit
2dda39dff0
7 changed files with 13 additions and 16 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazydocker/pkg/config"
|
"github.com/jesseduffield/lazydocker/pkg/config"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/i18n"
|
"github.com/jesseduffield/lazydocker/pkg/i18n"
|
||||||
|
|
@ -31,7 +31,7 @@ func NewDummyAppConfig() *config.AppConfig {
|
||||||
// NewDummyLog creates a new dummy Log for testing
|
// NewDummyLog creates a new dummy Log for testing
|
||||||
func NewDummyLog() *logrus.Entry {
|
func NewDummyLog() *logrus.Entry {
|
||||||
log := logrus.New()
|
log := logrus.New()
|
||||||
log.Out = ioutil.Discard
|
log.Out = io.Discard
|
||||||
return log.WithField("test", "test")
|
return log.WithField("test", "test")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package commands
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -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
|
// CreateTempFile writes a string to a new temp file and returns the file's name
|
||||||
func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
|
func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
|
||||||
tmpfile, err := ioutil.TempFile("", filename)
|
tmpfile, err := os.CreateTemp("", filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Log.Error(err)
|
c.Log.Error(err)
|
||||||
return "", WrapError(err)
|
return "", WrapError(err)
|
||||||
|
|
@ -342,7 +342,7 @@ func (c *OSCommand) PipeCommands(commandStrings ...string) error {
|
||||||
c.Log.Error(err)
|
c.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b, err := ioutil.ReadAll(stderr); err == nil {
|
if b, err := io.ReadAll(stderr); err == nil {
|
||||||
if len(b) > 0 {
|
if len(b) > 0 {
|
||||||
finalErrors = append(finalErrors, string(b))
|
finalErrors = append(finalErrors, string(b))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -290,7 +289,7 @@ func TestOSCommandCreateTempFile(t *testing.T) {
|
||||||
func(path string, err error) {
|
func(path string, err error) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
content, err := ioutil.ReadFile(path)
|
content, err := os.ReadFile(path)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, "content", string(content))
|
assert.Equal(t, "content", string(content))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -37,7 +36,7 @@ func NewSSHHandler(oSCommand CmdKiller) *SSHHandler {
|
||||||
return (&net.Dialer{}).DialContext(ctx, network, addr)
|
return (&net.Dialer{}).DialContext(ctx, network, addr)
|
||||||
},
|
},
|
||||||
startCmd: func(cmd *exec.Cmd) error { return cmd.Start() },
|
startCmd: func(cmd *exec.Cmd) error { return cmd.Start() },
|
||||||
tempDir: ioutil.TempDir,
|
tempDir: os.MkdirTemp,
|
||||||
getenv: os.Getenv,
|
getenv: os.Getenv,
|
||||||
setenv: os.Setenv,
|
setenv: os.Setenv,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
@ -65,8 +65,8 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Stdin = nil
|
cmd.Stdin = nil
|
||||||
cmd.Stdout = ioutil.Discard
|
cmd.Stdout = io.Discard
|
||||||
cmd.Stderr = ioutil.Discard
|
cmd.Stderr = io.Discard
|
||||||
|
|
||||||
gui.promptToReturn()
|
gui.promptToReturn()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ func newDevelopmentLogger(config *config.AppConfig) *logrus.Logger {
|
||||||
|
|
||||||
func newProductionLogger() *logrus.Logger {
|
func newProductionLogger() *logrus.Logger {
|
||||||
log := logrus.New()
|
log := logrus.New()
|
||||||
log.Out = ioutil.Discard
|
log.Out = io.Discard
|
||||||
log.SetLevel(logrus.ErrorLevel)
|
log.SetLevel(logrus.ErrorLevel)
|
||||||
return log
|
return log
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue