func indentVal(w io.Writer, x interface{}, indentStr string) {
	data, err := yaml.Marshal(x)
	if err != nil {
		panic(fmt.Errorf("cannot marshal YAML: %v", err))
	}
	if len(data) == 0 {
		panic("YAML cannot marshal to empty string")
	}
	indent := []byte(indentStr + "  ")
	if canUseSameLine(x) {
		w.Write(space)
	} else {
		w.Write(nl)
		w.Write(indent)
	}
	data = bytes.TrimSuffix(data, nl)
	lines := bytes.Split(data, nl)
	for i, line := range lines {
		if i > 0 {
			w.Write(indent)
		}
		w.Write(line)
		w.Write(nl)
	}
}
// indentVal writes the given YAML-formatted value x to w and prefixing
// the second and subsequent lines with the given ident.
indentVal writes the given YAML-formatted value x to w and prefixing
the second and subsequent lines with the given ident.
// indentVal writes the given YAML - formatted value x to w and prefixing // the second and subsequent lines with the given ident .
func indentVal(w io.Writer, x interface{}, indentStr string) {
	data, err := yaml.Marshal(x)
	if err != nil {
		panic(fmt.Errorf("cannot marshal YAML: %v", err))
	}
	if len(data) == 0 {
		panic("YAML cannot marshal to empty string")
	}
	indent := []byte(indentStr + "  ")
	if canUseSameLine(x) {
		w.Write(space)
	} else {
		w.Write(nl)
		w.Write(indent)
	}
	data = bytes.TrimSuffix(data, nl)
	lines := bytes.Split(data, nl)
	for i, line := range lines {
		if i > 0 {
			w.Write(indent)
		}
		w.Write(line)
		w.Write(nl)
	}
}
func indentVal ( w io . Writer , x interface { } , indentStr string ) { data , err := yaml . Marshal ( x ) if err != nil { panic ( fmt . Errorf ( " " , err ) ) } if len ( data ) == 0 { panic ( " " ) } indent := [ ] byte ( indentStr + " " ) if canUseSameLine ( x ) { w . Write ( space ) } else { w . Write ( nl ) w . Write ( indent ) } data = bytes . TrimSuffix ( data , nl ) lines := bytes . Split ( data , nl ) for i , line := range lines { if i > 0 { w . Write ( indent ) } w . Write ( line ) w . Write ( nl ) } }
indentVal writes the given YAML-formatted value x to w and prefixing
the second and subsequent lines with the given ident.
indentVal writes the given YAML - formatted value x to w and prefixing the second and subsequent lines with the given ident .