Skip to content

Commit a02a692

Browse files
committed
Update golangci-lint and fix lints
Signed-off-by: Sascha Grunert <[email protected]>
1 parent a8e8df7 commit a02a692

25 files changed

+251
-236
lines changed

.golangci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ linters:
3434
- errchkjson
3535
- errname
3636
- fatcontext
37+
- gci
3738
- ginkgolinter
3839
- gocheckcompilerdirectives
3940
- gochecksumtype
4041
- goconst
4142
- gocritic
4243
- gocyclo
44+
- godot
4345
- godox
4446
- gofmt
4547
- gofumpt
@@ -80,6 +82,7 @@ linters:
8082
- tagalign
8183
- tenv
8284
- testableexamples
85+
- testifylint
8386
- typecheck
8487
- unconvert
8588
- unparam
@@ -99,11 +102,9 @@ linters:
99102
# - forbidigo
100103
# - forcetypeassert
101104
# - funlen
102-
# - gci
103105
# - gochecknoglobals
104106
# - gochecknoinits
105107
# - gocognit
106-
# - godot
107108
# - inamedparam
108109
# - interfacebloat
109110
# - ireturn
@@ -118,7 +119,6 @@ linters:
118119
# - nonamedreturns
119120
# - paralleltest
120121
# - tagliatelle
121-
# - testifylint
122122
# - testpackage
123123
# - thelper
124124
# - tparallel
@@ -127,6 +127,13 @@ linters:
127127
# - wrapcheck
128128
# - wsl
129129
linters-settings:
130+
gci:
131+
sections:
132+
- standard
133+
- default
134+
- prefix(k8s.io)
135+
- prefix(sigs.k8s.io)
136+
- localmodule
130137
gocyclo:
131138
min-complexity: 40
132139
godox:

command/command.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/sirupsen/logrus"
3131
)
3232

33-
// A generic command abstraction
33+
// A generic command abstraction.
3434
type Command struct {
3535
cmds []*command
3636
stdErrWriters, stdOutWriters []io.Writer
@@ -39,7 +39,7 @@ type Command struct {
3939
filter *filter
4040
}
4141

42-
// The internal command representation
42+
// The internal command representation.
4343
type command struct {
4444
*exec.Cmd
4545
pipeWriter *io.PipeWriter
@@ -51,19 +51,19 @@ type filter struct {
5151
replaceAll string
5252
}
5353

54-
// A generic command exit status
54+
// A generic command exit status.
5555
type Status struct {
5656
waitStatus syscall.WaitStatus
5757
*Stream
5858
}
5959

60-
// Stream combines standard output and error
60+
// Stream combines standard output and error.
6161
type Stream struct { //nolint: errname
6262
stdOut string
6363
stdErr string
6464
}
6565

66-
// Commands is an abstraction over multiple Command structures
66+
// Commands is an abstraction over multiple Command structures.
6767
type Commands []*Command
6868

6969
// New creates a new command from the provided arguments.
@@ -91,7 +91,7 @@ func cmdWithDir(dir, cmd string, args ...string) *exec.Cmd {
9191
return c
9292
}
9393

94-
// Pipe creates a new command where the previous should be piped to
94+
// Pipe creates a new command where the previous should be piped to.
9595
func (c *Command) Pipe(cmd string, args ...string) *Command {
9696
pipeCmd := cmdWithDir(c.cmds[0].Dir, cmd, args...)
9797

@@ -121,7 +121,7 @@ func (c *Command) Verbose() *Command {
121121
}
122122

123123
// isVerbose returns true if the command is in verbose mode, either set locally
124-
// or global
124+
// or global.
125125
func (c *Command) isVerbose() bool {
126126
return GetGlobalVerbose() || c.verbose
127127
}
@@ -174,7 +174,7 @@ func (c *Command) Filter(regex, replaceAll string) (*Command, error) {
174174

175175
// Run starts the command and waits for it to finish. It returns an error if
176176
// the command execution was not possible at all, otherwise the Status.
177-
// This method prints the commands output during execution
177+
// This method prints the commands output during execution.
178178
func (c *Command) Run() (res *Status, err error) {
179179
return c.run(true)
180180
}
@@ -199,7 +199,7 @@ func (c *Command) RunSuccess() error {
199199
return err
200200
}
201201

202-
// String returns a string representation of the full command
202+
// String returns a string representation of the full command.
203203
func (c *Command) String() string {
204204
str := []string{}
205205
for _, x := range c.cmds {
@@ -246,7 +246,7 @@ func (c *Command) RunSilentSuccess() error {
246246
return err
247247
}
248248

249-
// run is the internal run method
249+
// run is the internal run method.
250250
func (c *Command) run(printOutput bool) (res *Status, err error) {
251251
var runErr error
252252
stdOutBuffer := &bytes.Buffer{}
@@ -371,17 +371,17 @@ func (c *Command) run(printOutput bool) (res *Status, err error) {
371371
return status, runErr
372372
}
373373

374-
// Success returns if a Status was successful
374+
// Success returns if a Status was successful.
375375
func (s *Status) Success() bool {
376376
return s.waitStatus.ExitStatus() == 0
377377
}
378378

379-
// ExitCode returns the exit status of the command status
379+
// ExitCode returns the exit status of the command status.
380380
func (s *Status) ExitCode() int {
381381
return s.waitStatus.ExitStatus()
382382
}
383383

384-
// Output returns stdout of the command status
384+
// Output returns stdout of the command status.
385385
func (s *Stream) Output() string {
386386
return s.stdOut
387387
}
@@ -392,7 +392,7 @@ func (s *Stream) OutputTrimNL() string {
392392
return strings.TrimSpace(s.stdOut)
393393
}
394394

395-
// Error returns the stderr of the command status
395+
// Error returns the stderr of the command status.
396396
func (s *Stream) Error() string {
397397
return s.stdErr
398398
}

0 commit comments

Comments
 (0)