reflect: add StructField.IsExported method

This field was introduced in Go 1.17 and is used by the encoding/json
package (starting with Go 1.17).
This commit is contained in:
Ayke van Laethem
2021-08-14 15:52:45 +02:00
committed by Ron Evans
parent ad73986070
commit d45497691f
3 changed files with 19 additions and 0 deletions
+5
View File
@@ -706,6 +706,11 @@ type StructField struct {
Offset uintptr
}
// IsExported reports whether the field is exported.
func (f StructField) IsExported() bool {
return f.PkgPath == ""
}
// rawStructField is the same as StructField but with the Type member replaced
// with rawType. For internal use only. Avoiding this conversion to the Type
// interface improves code size in many cases.