Browse Source

testutil: don't panic on AssertNil on non-nil errors

Anthony Romano 8 years ago
parent
commit
67d932154c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      pkg/testutil/assert.go

+ 5 - 1
pkg/testutil/assert.go

@@ -54,5 +54,9 @@ func AssertFalse(t *testing.T, v bool, msg ...string) {
 }
 }
 
 
 func isNil(v interface{}) bool {
 func isNil(v interface{}) bool {
-	return v == nil || reflect.ValueOf(v).IsNil()
+	if v == nil {
+		return true
+	}
+	rv := reflect.ValueOf(v)
+	return rv.Kind() != reflect.Struct && rv.IsNil()
 }
 }