summaryrefslogtreecommitdiff
path: root/reflect.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2022-10-29 14:47:13 -0400
committerAlex Flint <[email protected]>2022-10-29 14:47:13 -0400
commit27c832b934678d80580efd9940e5183ef3d687da (patch)
tree3e0793345f62b089746d517aae7453ff29715151 /reflect.go
parent197e226c771464f7c0b66cc2a2bbfb646010dc52 (diff)
store both a default value and a string representation of that default value in the spec for each option
Diffstat (limited to 'reflect.go')
-rw-r--r--reflect.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/reflect.go b/reflect.go
index b87db2a..64c6343 100644
--- a/reflect.go
+++ b/reflect.go
@@ -16,9 +16,9 @@ var (
)
// cardinality tracks how many tokens are expected for a given spec
-// - zero is a boolean, which does to expect any value
-// - one is an ordinary option that will be parsed from a single token
-// - multiple is a slice or map that can accept zero or more tokens
+// - zero is a boolean, which does to expect any value
+// - one is an ordinary option that will be parsed from a single token
+// - multiple is a slice or map that can accept zero or more tokens
type cardinality int
const (
@@ -110,7 +110,7 @@ func isExported(field string) bool {
// isZero returns true if v contains the zero value for its type
func isZero(v reflect.Value) bool {
t := v.Type()
- if t.Kind() == reflect.Slice || t.Kind() == reflect.Map {
+ if t.Kind() == reflect.Pointer || t.Kind() == reflect.Slice || t.Kind() == reflect.Map || t.Kind() == reflect.Chan || t.Kind() == reflect.Interface {
return v.IsNil()
}
if !t.Comparable() {