Skip to content

Commit

Permalink
Stopped nolintlint and gofmt from fighting each other
Browse files Browse the repository at this point in the history
Nolintlint wants the //nolint directives without a leading space
GoFmt wants them with a leading space, ...
   except if nolint has no space afterwards:

// nolint:foo // <-- malformed
//nolint :foo // <-- malformed
//nolint: foo // <-- malformed

//nolint:foo // <-- OK

See golangci/golangci-lint#3110 (comment)
  • Loading branch information
EduardGomezEscandell committed Mar 8, 2023
1 parent d26ef0e commit 5e5e974
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend_mock.go
Expand Up @@ -26,6 +26,6 @@ func selectBackend(ctx context.Context) backend.Backend {
return windows.Backend{}
}

//nolint: forcetypeassert // The panic is expected and welcome
//nolint:forcetypeassert // The panic is expected and welcome
return v.(backend.Backend)
}
4 changes: 2 additions & 2 deletions exec.go
Expand Up @@ -145,7 +145,7 @@ func (c *Cmd) Start() (err error) {
go func() {
select {
case <-c.ctx.Done():
//nolint: errcheck // Mimicking behaviour from stdlib
//nolint:errcheck // Mimicking behaviour from stdlib
c.Process.Kill()
// We deviate from the stdlib: "context cancelled" is more useful than "exit code 1"
c.ctxErr = c.ctx.Err()
Expand Down Expand Up @@ -178,7 +178,7 @@ func (c *Cmd) Output() (out []byte, err error) {
if err != nil && captureErr {
target := &exec.ExitError{}
if errors.As(err, &target) {
//nolint: forcetypeassert
//nolint:forcetypeassert
// copied from stdlib. We know this to be true because it is set further up in this same function
target.Stderr = c.Stderr.(*prefixSuffixSaver).Bytes()
}
Expand Down
4 changes: 2 additions & 2 deletions exec_test.go
Expand Up @@ -612,7 +612,7 @@ print("Your text was", v)
// - In the happy path (all checks pass) we'll have waited on the command already, so
// this second wait is superfluous.
// - If a check fails, we don't really care about any subsequent errors like this one.
defer cmd.Wait() //nolint: errcheck
defer cmd.Wait() //nolint:errcheck

buffer := make([]byte, 1024)

Expand Down Expand Up @@ -642,7 +642,7 @@ print("Your text was", v)
require.NoError(t, err, "Unexpected error on command wait")

if tc.readFrom == readFromPipe {
err = stdin.(io.WriteCloser).Close() //nolint: forcetypeassert
err = stdin.(io.WriteCloser).Close() //nolint:forcetypeassert
require.NoError(t, err, "Failed to close stdin pipe multiple times")
}
})
Expand Down
2 changes: 1 addition & 1 deletion registration_test.go
Expand Up @@ -165,7 +165,7 @@ func TestUnregister(t *testing.T) {
// called in order to deallocate resources. You can call cancel multiple times without
// adverse effect.
//
//nolint: revive // No, I wont' put the context before the *testing.T.
//nolint:revive // No, I wont' put the context before the *testing.T.
func wslShutdownTimeout(t *testing.T, ctx context.Context, timeout time.Duration) (cancel func()) {
t.Helper()

Expand Down

0 comments on commit 5e5e974

Please sign in to comment.