diff options
Diffstat (limited to 'integrationtests/commandutils.go')
| -rw-r--r-- | integrationtests/commandutils.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/integrationtests/commandutils.go b/integrationtests/commandutils.go index 959288a..8d81955 100644 --- a/integrationtests/commandutils.go +++ b/integrationtests/commandutils.go @@ -17,7 +17,7 @@ func runCommand(ctx context.Context, t *testing.T, stdoutFile, cmdStr string, args ...string) (int, error) { if _, err := os.Stat(cmdStr); err != nil { - return 0, fmt.Errorf("no such executable '%s', please compile first: %v", cmdStr, err) + return 0, fmt.Errorf("no such executable '%s', please compile first: %w", cmdStr, err) } t.Log("Creating stdout file", stdoutFile) @@ -31,7 +31,7 @@ func runCommand(ctx context.Context, t *testing.T, stdoutFile, cmdStr string, cmd := exec.CommandContext(ctx, cmdStr, args...) out, err := cmd.CombinedOutput() t.Log("Done running command!", err) - fd.Write(out) + _, _ = fd.Write(out) return exitCodeFromError(err), err } @@ -56,7 +56,7 @@ func startCommand(ctx context.Context, t *testing.T, inPipeFile, if _, err := os.Stat(cmdStr); err != nil { return stdoutCh, stderrCh, nil, - fmt.Errorf("no such executable '%s', please compile first: %v", cmdStr, err) + fmt.Errorf("no such executable '%s', please compile first: %w", cmdStr, err) } t.Log(cmdStr, strings.Join(args, " ")) @@ -85,13 +85,13 @@ func startCommand(ctx context.Context, t *testing.T, inPipeFile, // Read input file and send to stdin pipe? if inPipeFile != "" { - t.Log(fmt.Sprintf("Piping %s to stdin pipe", inPipeFile)) + t.Logf("Piping %s to stdin pipe", inPipeFile) fd, err := os.Open(inPipeFile) if err != nil { return stdoutCh, stderrCh, nil, err } go func() { - io.Copy(stdinPipe, bufio.NewReader(fd)) + _, _ = io.Copy(stdinPipe, bufio.NewReader(fd)) stdinPipe.Close() fd.Close() }() @@ -135,8 +135,8 @@ func waitForCommand(ctx context.Context, t *testing.T, t.Log(line) } case cmdErr := <-cmdErrCh: - t.Log(fmt.Sprintf("Command finished with with exit code %d: %v", - exitCodeFromError(cmdErr), cmdErr)) + t.Logf("Command finished with with exit code %d: %v", + exitCodeFromError(cmdErr), cmdErr) return } } @@ -150,5 +150,5 @@ func exitCodeFromError(err error) int { ws := exitError.Sys().(syscall.WaitStatus) return ws.ExitStatus() } - panic(fmt.Sprintf("Unable to get process exit code from error: %v", err)) + panic(fmt.Errorf("Unable to get process exit code from error: %w", err)) } |
