golang format tools (#892)

Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
/assign n3wscott
This commit is contained in:
Matt Moore 2019-11-21 11:06:08 -08:00 committed by Knative Prow Robot
parent 0400231005
commit cd063fbc21
2 changed files with 15 additions and 15 deletions

View File

@ -29,8 +29,8 @@ import (
const (
invalidInputErrorPrefix = "invalid input: "
defaultErrCode = 1
separator = "\n"
defaultErrCode = 1
separator = "\n"
)
// RunCommand will run the command and return the standard output, plus error if there is one.
@ -38,9 +38,9 @@ func RunCommand(cmdLine string) (string, error) {
cmdSplit, err := shell.Split(cmdLine)
if len(cmdSplit) == 0 || err != nil {
return "", &CommandLineError{
Command: cmdLine,
Command: cmdLine,
ErrorOutput: []byte(invalidInputErrorPrefix + cmdLine),
ErrorCode: defaultErrCode,
ErrorCode: defaultErrCode,
}
}
@ -53,9 +53,9 @@ func RunCommand(cmdLine string) (string, error) {
out, err := cmd.Output()
if err != nil {
return string(out), &CommandLineError{
Command: cmdLine,
Command: cmdLine,
ErrorOutput: eb.Bytes(),
ErrorCode: getErrorCode(err),
ErrorCode: getErrorCode(err),
}
}

View File

@ -23,10 +23,10 @@ import (
func TestRunCommand(t *testing.T) {
testCases := []struct {
command string
expectedOutput string
command string
expectedOutput string
expectedErrorOutput string
expectedErrorCode int
expectedErrorCode int
}{
{"", "", invalidInputErrorPrefix + "", 1},
{" ", "", invalidInputErrorPrefix + " ", 1},
@ -62,10 +62,10 @@ func TestRunCommand(t *testing.T) {
func TestRunCommands(t *testing.T) {
testCases := []struct {
commands []string
expectedOutput string
commands []string
expectedOutput string
expectedErrorOutput string
expectedErrorCode int
expectedErrorCode int
}{
{
[]string{"echo 123", "echo 234", "echo 345"},
@ -127,8 +127,8 @@ func TestRunCommands(t *testing.T) {
func TestRunCommandsInParallel(t *testing.T) {
testCases := []struct {
commands []string
possibleOutput []string
commands []string
possibleOutput []string
possibleErrorOutput []string
}{
{
@ -151,7 +151,7 @@ func TestRunCommandsInParallel(t *testing.T) {
out, err := RunCommandsInParallel(c.commands...)
idx := -1
for i := range c.possibleOutput {
for i := range c.possibleOutput {
if c.possibleOutput[i] == out {
idx = i
break