func VerifyNoOverlayFieldsPresent(bd *BundleData) error {
	var (
		errList   []error
		pathStack []string
	)

	ctx := &visitorContext{
		structVisitor: func(ctx *visitorContext, val reflect.Value, typ reflect.Type) (foundOverlay bool) {
			for i := 0; i < typ.NumField(); i++ {
				structField := typ.Field(i)

				// Skip non-exportable and empty fields
				v := val.Field(i)
				if !v.CanInterface() || isZero(v) {
					continue
				}

				if isOverlayField(structField) {
					errList = append(
						errList,
						fmt.Errorf(
							"%s.%s can only appear in an overlay section",
							strings.Join(pathStack, "."),
							yamlName(structField),
						),
					)
					foundOverlay = true
				}

				pathStack = append(pathStack, yamlName(structField))
				if visitField(ctx, v.Interface()) {
					foundOverlay = true
				}
				pathStack = pathStack[:len(pathStack)-1]
			}
			return foundOverlay
		},
		indexedElemPreVisitor: func(index interface{}) {
			pathStack = append(pathStack, fmt.Sprint(index))
		},
		indexedElemPostVisitor: func(_ interface{}) {
			pathStack = pathStack[:len(pathStack)-1]
		},
	}

	_ = visitField(ctx, bd)
	if len(errList) == 0 {
		return nil
	}

	return &VerificationError{errList}
}
// VerifyNoOverlayFieldsPresent scans the contents of bd and returns an error
// if the bundle contains any overlay-specific values.
VerifyNoOverlayFieldsPresent scans the contents of bd and returns an error
if the bundle contains any overlay-specific values.
// VerifyNoOverlayFieldsPresent scans the contents of bd and returns an error // if the bundle contains any overlay - specific values .
func VerifyNoOverlayFieldsPresent(bd *BundleData) error {
	var (
		errList   []error
		pathStack []string
	)
	ctx := &visitorContext{
		structVisitor: func(ctx *visitorContext, val reflect.Value, typ reflect.Type) (foundOverlay bool) {
			for i := 0; i < typ.NumField(); i++ {
				structField := typ.Field(i)
				v := val.Field(i)
				if !v.CanInterface() || isZero(v) {
					continue
				}
				if isOverlayField(structField) {
					errList = append(
						errList,
						fmt.Errorf(
							"%s.%s can only appear in an overlay section",
							strings.Join(pathStack, "."),
							yamlName(structField),
						),
					)
					foundOverlay = true
				}
				pathStack = append(pathStack, yamlName(structField))
				if visitField(ctx, v.Interface()) {
					foundOverlay = true
				}
				pathStack = pathStack[:len(pathStack)-1]
			}
			return foundOverlay
		},
		indexedElemPreVisitor: func(index interface{}) {
			pathStack = append(pathStack, fmt.Sprint(index))
		},
		indexedElemPostVisitor: func(_ interface{}) {
			pathStack = pathStack[:len(pathStack)-1]
		},
	}
	_ = visitField(ctx, bd)
	if len(errList) == 0 {
		return nil
	}
	return &VerificationError{errList}
}
func VerifyNoOverlayFieldsPresent ( bd * BundleData ) error { var ( errList [ ] error pathStack [ ] string ) ctx := & visitorContext { structVisitor : func ( ctx * visitorContext , val reflect . Value , typ reflect . Type ) ( foundOverlay bool ) { for i := 0 ; i < typ . NumField ( ) ; i ++ { structField := typ . Field ( i ) v := val . Field ( i ) if ! v . CanInterface ( ) || isZero ( v ) { continue } if isOverlayField ( structField ) { errList = append ( errList , fmt . Errorf ( " " , strings . Join ( pathStack , " " ) , yamlName ( structField ) , ) , ) foundOverlay = true } pathStack = append ( pathStack , yamlName ( structField ) ) if visitField ( ctx , v . Interface ( ) ) { foundOverlay = true } pathStack = pathStack [ : len ( pathStack ) - 1 ] } return foundOverlay } , indexedElemPreVisitor : func ( index interface { } ) { pathStack = append ( pathStack , fmt . Sprint ( index ) ) } , indexedElemPostVisitor : func ( _ interface { } ) { pathStack = pathStack [ : len ( pathStack ) - 1 ] } , } _ = visitField ( ctx , bd ) if len ( errList ) == 0 { return nil } return & VerificationError { errList } }
VerifyNoOverlayFieldsPresent scans the contents of bd and returns an error
if the bundle contains any overlay-specific values.
VerifyNoOverlayFieldsPresent scans the contents of bd and returns an error if the bundle contains any overlay - specific values .
// Skip non-exportable and empty fields