mirror of https://github.com/knative/pkg.git
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:
parent
0400231005
commit
cd063fbc21
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue