mirror of https://github.com/Hilbis/Hilbish
feat: add docgen program
parent
f9133584d4
commit
ecbcf9a968
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue