func resolveIncludes(includeResolver func(path string) ([]byte, error), v interface{}) (string, bool, error) {
	directives := []struct {
		directive string
		encoder   func([]byte) string
	}{
		{
			directive: "include-file://",
			encoder: func(d []byte) string {
				return string(d)
			},
		},
		{
			directive: "include-base64://",
			encoder:   base64.StdEncoding.EncodeToString,
		},
	}

	val, isString := v.(string)
	if !isString {
		return "", false, nil
	}

	for _, dir := range directives {
		if !strings.HasPrefix(val, dir.directive) {
			continue
		}

		path := val[len(dir.directive):]
		data, err := includeResolver(path)
		if err != nil {
			return "", false, errors.Annotatef(err, "resolving include %q", path)
		}

		return dir.encoder(data), true, nil
	}

	return val, false, nil
}
// resolveIncludes operates on v which is expected to be string. It checks the
// value for the presence of an include directive. If such a directive is
// located, resolveIncludes invokes the provided includeResolver and returns
// back its output after applying the appropriate encoding for the directive.
resolveIncludes operates on v which is expected to be string. It checks the
value for the presence of an include directive. If such a directive is
located, resolveIncludes invokes the provided includeResolver and returns
back its output after applying the appropriate encoding for the directive.
// resolveIncludes operates on v which is expected to be string . It checks the // value for the presence of an include directive . If such a directive is // located resolveIncludes invokes the provided includeResolver and returns // back its output after applying the appropriate encoding for the directive .
func resolveIncludes(includeResolver func(path string) ([]byte, error), v interface{}) (string, bool, error) {
	directives := []struct {
		directive string
		encoder   func([]byte) string
	}{
		{
			directive: "include-file://",
			encoder: func(d []byte) string {
				return string(d)
			},
		},
		{
			directive: "include-base64://",
			encoder:   base64.StdEncoding.EncodeToString,
		},
	}
	val, isString := v.(string)
	if !isString {
		return "", false, nil
	}
	for _, dir := range directives {
		if !strings.HasPrefix(val, dir.directive) {
			continue
		}
		path := val[len(dir.directive):]
		data, err := includeResolver(path)
		if err != nil {
			return "", false, errors.Annotatef(err, "resolving include %q", path)
		}
		return dir.encoder(data), true, nil
	}
	return val, false, nil
}
func resolveIncludes ( includeResolver func ( path string ) ( [ ] byte , error ) , v interface { } ) ( string , bool , error ) { directives := [ ] struct { directive string encoder func ( [ ] byte ) string } { { directive : " " , encoder : func ( d [ ] byte ) string { return string ( d ) } , } , { directive : " " , encoder : base64 . StdEncoding . EncodeToString , } , } val , isString := v . ( string ) if ! isString { return " " , false , nil } for _ , dir := range directives { if ! strings . HasPrefix ( val , dir . directive ) { continue } path := val [ len ( dir . directive ) : ] data , err := includeResolver ( path ) if err != nil { return " " , false , errors . Annotatef ( err , " " , path ) } return dir . encoder ( data ) , true , nil } return val , false , nil }
resolveIncludes operates on v which is expected to be string.
resolveIncludes operates on v which is expected to be string .