undo CL 13004046 / 5db14b33d6ef

Flushing after every token negates the point of buffering. A different approach is required.

««« original CL description
encoding/xml: flush buffer after encoding token

R=rsc, bradfitz, adg
CC=golang-dev
https://golang.org/cl/13004046

»»»

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/13515043
diff --git a/src/pkg/encoding/xml/marshal.go b/src/pkg/encoding/xml/marshal.go
index 06bdec4..a6ee5d5 100644
--- a/src/pkg/encoding/xml/marshal.go
+++ b/src/pkg/encoding/xml/marshal.go
@@ -196,6 +196,7 @@
 		p.WriteString("<!--")
 		p.Write(t)
 		p.WriteString("-->")
+		return p.cachedWriteError()
 	case ProcInst:
 		if t.Target == "xml" || !isNameString(t.Target) {
 			return fmt.Errorf("xml: EncodeToken of ProcInst with invalid Target")
@@ -218,7 +219,7 @@
 		p.Write(t)
 		p.WriteString(">")
 	}
-	return p.Flush()
+	return p.cachedWriteError()
 }
 
 type printer struct {