Re: [go-nuts] get function body comments using ast

2022-10-10 Thread 'wagner riffel' via golang-nuts
On 10/9/22 11:09, Dmitry Belyaev wrote: For a function like below I'd get only *example // doc comment*, // doc comment func example() {   // body comment   < looking to extract this comment } but I am looking also to extract *// body comment*. Please advise on how to extract function nam

[go-nuts] get function body comments using ast

2022-10-09 Thread Dmitry Belyaev
Hey fellow gophers, I am trying to get comments from inside of function declaration while also accessing function name, but haven't had much success. Getting name and doc is quite straightforward, I do it with: fset := token.NewFileSet() f, _ := parser.ParseFile(fset, "testfile", nil,