Browse Source

Fix tests

Signed-off-by: Ulysses Souza <[email protected]>
Ulysses Souza 5 years ago
parent
commit
fb59c9385d
2 changed files with 3 additions and 7 deletions
  1. 3 3
      cli/cmd/version_test.go
  2. 0 4
      formatter/json.go

+ 3 - 3
cli/cmd/version_test.go

@@ -31,7 +31,7 @@ func TestVersionFormat(t *testing.T) {
 	jsonCases := []caze{
 		{
 			Actual:   fixedJSONArgs([]string{}),
-			Expected: nil,
+			Expected: []string{},
 		},
 		{
 			Actual: fixedJSONArgs([]string{
@@ -103,7 +103,7 @@ func TestVersionFormat(t *testing.T) {
 	prettyCases := []caze{
 		{
 			Actual:   fixedPrettyArgs([]string{}),
-			Expected: nil,
+			Expected: []string{},
 		},
 		{
 			Actual: fixedPrettyArgs([]string{
@@ -172,7 +172,7 @@ func TestVersionFormat(t *testing.T) {
 				"--format",
 				"pretty",
 			}),
-			Expected: nil,
+			Expected: []string{},
 		},
 	}
 

+ 0 - 4
formatter/json.go

@@ -18,16 +18,12 @@ package formatter
 
 import (
 	"encoding/json"
-	"reflect"
 )
 
 const standardIndentation = "    "
 
 // ToStandardJSON return a string with the JSON representation of the interface{}
 func ToStandardJSON(i interface{}) (string, error) {
-	if reflect.ValueOf(i).IsNil() {
-		return "{}", nil
-	}
 	b, err := json.MarshalIndent(i, "", standardIndentation)
 	if err != nil {
 		return "", err