We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06ac303 commit 0dfb6fbCopy full SHA for 0dfb6fb
src/go/ast/commentmap.go
@@ -315,9 +315,17 @@ loop:
315
}
316
317
func (cmap CommentMap) String() string {
318
+ // print map entries in sorted order
319
+ var nodes []Node
320
+ for node := range cmap {
321
+ nodes = append(nodes, node)
322
+ }
323
+ sort.Sort(byInterval(nodes))
324
+
325
var buf bytes.Buffer
326
fmt.Fprintln(&buf, "CommentMap {")
- for node, comment := range cmap {
327
+ for _, node := range nodes {
328
+ comment := cmap[node]
329
// print name of identifiers; print node type for other nodes
330
var s string
331
if ident, ok := node.(*Ident); ok {
0 commit comments