Skip to content

Commit

Permalink
update isEmptyValue function
Browse files Browse the repository at this point in the history
  • Loading branch information
danawillow committed Jan 2, 2020
1 parent 8cddcb7 commit 7f2863c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d T
return nil, nil
}

return bigtableadmin.MultiClusterRoutingUseAny{}, nil
return map[string]interface{}{}, nil
}
16 changes: 1 addition & 15 deletions third_party/terraform/utils/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,7 @@ import (
var DefaultRequestTimeout = 5 * time.Minute

func isEmptyValue(v reflect.Value) bool {
switch v.Kind() {
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
return v.Len() == 0
case reflect.Bool:
return !v.Bool()
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return v.Int() == 0
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
return v.Uint() == 0
case reflect.Float32, reflect.Float64:
return v.Float() == 0
case reflect.Interface, reflect.Ptr:
return v.IsNil()
}
return false
return !v.IsValid() || v.IsZero()
}

func sendRequest(config *Config, method, project, rawurl string, body map[string]interface{}, errorRetryPredicates ...func(e error) (bool, string)) (map[string]interface{}, error) {
Expand Down

0 comments on commit 7f2863c

Please sign in to comment.