Allow comment to start directly after the prefix.
diff --git a/properties.go b/properties.go
index ccf91fa..bba79d5 100644
--- a/properties.go
+++ b/properties.go
@@ -459,7 +459,7 @@
// WriteComment writes all unexpanced 'key = value' pairs to the given writer.
// If prefix is not empty then comments are written with a blank line and the
-// given prefix. The prefix should be either "#" or "!" to be compatible with
+// given prefix. The prefix should be either "# " or "! " to be compatible with
// the properties file format. Otherwise, the properties parser will not be
// able to read the file back in. It returns the number of bytes written and
// any write error encountered.
@@ -481,7 +481,7 @@
}
for _, c := range comments {
- x, err = fmt.Fprintf(w, "%s %s\n", prefix, encode(c, "", enc))
+ x, err = fmt.Fprintf(w, "%s%s\n", prefix, encode(c, "", enc))
if err != nil {
return
}
diff --git a/properties_test.go b/properties_test.go
index a1b02bf..fa998ef 100644
--- a/properties_test.go
+++ b/properties_test.go
@@ -657,9 +657,9 @@
var n int
switch test.encoding {
case "UTF-8":
- n, err = p.WriteComment(buf, "#", UTF8)
+ n, err = p.WriteComment(buf, "# ", UTF8)
case "ISO-8859-1":
- n, err = p.WriteComment(buf, "#", ISO_8859_1)
+ n, err = p.WriteComment(buf, "# ", ISO_8859_1)
}
c.Assert(err, IsNil)
s := string(buf.Bytes())