mirror of
https://github.com/Hilbis/Hilbish
synced 2025-03-28 09:20:41 +00:00
feat: add docgen program
This commit is contained in:
parent
f9133584d4
commit
ecbcf9a968
27
cmd/docgen/docgen.go
Normal file
27
cmd/docgen/docgen.go
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user