diff --git a/mapstructure.go b/mapstructure.go index c52ebacb..49e2c331 100644 --- a/mapstructure.go +++ b/mapstructure.go @@ -115,6 +115,31 @@ // Age int `mapstructure:",omitempty"` // } // +// Unexported fields +// +// Since unexported (private) struct fields cannot be set outside the package +// where they are defined, the decoder will simply skip them. +// +// For this output type definition: +// +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } +// +// Using this map as input: +// +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } +// +// The following struct will be decoded: +// +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// // Other Configuration // // mapstructure is highly configurable. See the DecoderConfig struct