Skip to content

go/ast: CommentMap mishandles loose, trailing file comments #21755

Description

@mvdan

go version devel +812b34efae Mon Sep 4 00:07:33 2017 +0000 linux/amd64

Construct a comment map for:

package p

func f() {
        return
}

// loose trailing comment

The loose trailing comment is associated in the CommentMap with the
return statement inside f. It should probably be associated with f
instead, and the NewCommentMap docs updated with new rules.

Live proof: https://play.golang.org/p/XCktcSxYl8

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions