mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
xml: omit newline at beginning of MarshalIndent output
(Still valid XML.) Fixes #3354. R=golang-dev, dave CC=golang-dev https://golang.org/cl/7288047
This commit is contained in:
parent
09a17ca1f1
commit
848d10f06c
2 changed files with 38 additions and 1 deletions
|
|
@ -124,6 +124,7 @@ type printer struct {
|
|||
prefix string
|
||||
depth int
|
||||
indentedIn bool
|
||||
putNewline bool
|
||||
}
|
||||
|
||||
// marshalValue writes one or more XML elements representing val.
|
||||
|
|
@ -394,7 +395,11 @@ func (p *printer) writeIndent(depthDelta int) {
|
|||
}
|
||||
p.indentedIn = false
|
||||
}
|
||||
p.WriteByte('\n')
|
||||
if p.putNewline {
|
||||
p.WriteByte('\n')
|
||||
} else {
|
||||
p.putNewline = true
|
||||
}
|
||||
if len(p.prefix) > 0 {
|
||||
p.WriteString(p.prefix)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue