Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build ast from any.
Example ¶
package main import ( "go/printer" "go/token" "log" "os" "github.com/itchyny/astgen-go" ) type X struct { x int y Y z *Z } type Y struct { y int } type Z struct { s string t map[string]int } func main() { x := &X{1, Y{2}, &Z{"hello", map[string]int{"x": 42}}} t, err := astgen.Build(x) if err != nil { log.Fatal(err) } err = printer.Fprint(os.Stdout, token.NewFileSet(), t) if err != nil { log.Fatal(err) } }
Output: &X{x: 1, y: Y{y: 2}, z: &Z{s: "hello", t: map[string]int{"x": 42}}}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.