It seems the standard doc package is not parsing go:generate comments. Any idea how can I get those comments?
1条回答 默认 最新
dongxueji2838 2015-02-18 13:38关注Package
go/parserin the standard library gets you anast.Packagevalue, representing an abstract syntax tree of a single package. This tree includesast.Commentnodes, whose textual content you can easily access through theirTextfield.Edit:
Dewy Broto contributed: A more direct option is to call the go/scanner package with the ScanComments flag set to true. There's no need to build an AST to find the comments
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报