Golang go/doc.New() function example

var dirname string

package go/doc

New computes the package documentation for the given package AST. New takes ownership of the AST pkg and may edit or overwrite it.

Golang go/doc.New() function usage example

 var m doc.Mode
 pkgName := astFile.Name.Name
 astPkg := ast.Package{
 Name: pkgName,
 Files: map[string]*ast.File{
 filename: astFile,
 },
 }
 docPkg := doc.New(&astPkg, dirname, m) //<-- here
 synopsis := doc.Synopsis(docPkg.Doc)

Reference :

http://golang.org/pkg/go/doc/#New

Advertisement