]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: enhance docs for IsZero and IsValid
authorMarko Kungla <marko.kungla@gmail.com>
Sat, 7 Sep 2019 09:07:08 +0000 (12:07 +0300)
committerIan Lance Taylor <iant@golang.org>
Wed, 11 Sep 2019 00:16:10 +0000 (00:16 +0000)
Make it clear that IsValid checks that we have valid
reflect.Value and not the value of `v`

fixes #34152

Change-Id: Ib3d359eeb3a82bf733b9ed17c777fc4c143bc29c
Reviewed-on: https://go-review.googlesource.com/c/go/+/193841
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/internal/reflectlite/value.go
src/reflect/value.go

index 308cf98fc80faa420db4361c7fd55e1746c5c419..6a493938f536ad43176995e3d4a8089ea91a879e 100644 (file)
@@ -305,7 +305,7 @@ func (v Value) IsNil() bool {
 // IsValid reports whether v represents a value.
 // It returns false if v is the zero Value.
 // If IsValid returns false, all other methods except String panic.
-// Most functions and methods never return an invalid value.
+// Most functions and methods never return an invalid Value.
 // If one does, its documentation states the conditions explicitly.
 func (v Value) IsValid() bool {
        return v.flag != 0
index 2e80bfe77f3dacbce80d5a9c3287d2b1f0dc8c2a..7fec09962ce8ad96a7485546d87a00869695917c 100644 (file)
@@ -1076,7 +1076,7 @@ func (v Value) IsNil() bool {
 // IsValid reports whether v represents a value.
 // It returns false if v is the zero Value.
 // If IsValid returns false, all other methods except String panic.
-// Most functions and methods never return an invalid value.
+// Most functions and methods never return an invalid Value.
 // If one does, its documentation states the conditions explicitly.
 func (v Value) IsValid() bool {
        return v.flag != 0