diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go index 1061f1d3ce..300966a326 100644 --- a/src/go/ast/ast.go +++ b/src/go/ast/ast.go @@ -57,6 +57,11 @@ type Decl interface { // Comments // A Comment node represents a single //-style or /*-style comment. +// +// The Text field contains the comment text without carriage returns (\r) that +// may have been present in the source. Because a comment's end position is +// computed using len(Text), the position reported by End() does not match the +// true source end position for comments containing carriage returns. type Comment struct { Slash token.Pos // position of "/" starting the comment Text string // comment text (excluding '\n' for //-style comments)