printer: fix newline for standalone comments

This commit is contained in:
Fatih Arslan 2015-11-01 01:29:26 +03:00
parent 858f6116bf
commit 566c59bf69
2 changed files with 5 additions and 2 deletions

View File

@ -116,7 +116,11 @@ func (p *printer) output(n interface{}) []byte {
buf.WriteString(comment.Text)
// TODO(arslan): do not print new lines if the comments are one liner
buf.Write([]byte{newline, newline})
buf.WriteByte(newline)
if index != len(t.Items) {
buf.WriteByte(newline)
}
}
}
}

View File

@ -14,4 +14,3 @@ aligned = {
numbers = [1, 2] // another line here
# Standalone 4