feat: add docgen program

pull/78/head
sammyette 2021-10-15 23:58:56 -04:00
parent f9133584d4
commit ecbcf9a968
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package main
import (
"fmt"
"go/doc"
"go/parser"
"go/token"
)
func main() {
fset := token.NewFileSet()
d, err := parser.ParseDir(fset, "./", nil, parser.ParseComments)
if err != nil {
fmt.Println(err)
return
}
for _, f := range d {
p := doc.New(f, "./", 0)
for _, t := range p.Funcs {
fmt.Println(" type", t.Name)
fmt.Println(" docs:", t.Doc)
}
}
}