使用encoding / xml.Encoder如何将xml标头放在自己的行上?

I have the following code that uses xml.Encode.

package main

import (
    "bytes"
    "encoding/xml"
    "fmt"
)

type Stuff struct {
    Name string `xml:"name"`
}

func main() {
    w := &bytes.Buffer{}
    enc := xml.NewEncoder(w)
    enc.Indent("", "  ")
    procInst := xml.ProcInst{
        Target: "xml",
        Inst:   []byte("version=\"1.0\" encoding=\"UTF-8\""),
    }
    if err := enc.EncodeToken(procInst); err != nil {
        panic(err)
    }

    if err := enc.Encode(Stuff{"My stuff"}); err != nil {
        panic(err)
    }
    fmt.Println(w.String())
}

http://play.golang.org/p/ZtZ5FGABmj

It prints:

<?xml version="1.0" encoding="UTF-8"?><Stuff>
  <name>My stuff</name>
</Stuff>

How do I make it print with the <Stuff> start tag on a new line:

<?xml version="1.0" encoding="UTF-8"?>
<Stuff>
  <name>My stuff</name>
</Stuff>

Unfortunately I need to write more here so that I can submit the question. Not really sure what to write though because I believe my question is summarized adequately with the above explanation.

How about just write that one static line with a newline character yourself? Go Playground

w := &bytes.Buffer{}
w.Write([]byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?>
"))

enc := xml.NewEncoder(w)
enc.Indent("", "  ")
if err := enc.Encode(Stuff{"My stuff"}); err != nil {
    panic(err)
}
fmt.Println(w.String())

This one line is even defined as a constant in the xml package, so you can simply write: Go Playground

w := &bytes.Buffer{}
w.WriteString(xml.Header)