~emersion/go-scfg

0b4e72d8ec3ce336ad7dcfa13757198f97b8b133 — Simon Ser 6 months ago b64c4e5
Error out on anonymous struct field

These are not supported at the moment. Make this clear by failing
early instead of silently ignoring such fields.
1 files changed, 3 insertions(+), 1 deletions(-)

M struct.go
M struct.go => struct.go +3 -1
@@ 33,7 33,9 @@ func getStructInfo(t reflect.Type) (*structInfo, error) {

	for i := 0; i < t.NumField(); i++ {
		f := t.Field(i)
		if !f.IsExported() {
		if f.Anonymous {
			return nil, fmt.Errorf("scfg: anonymous struct fields are not supported")
		} else if !f.IsExported() {
			continue
		}