func (f *FileBuilder) Build() (*File, error) { var err error = nil func() { defer fail.Using(func(args ...interface{}) { err = errors.New(fmt.Sprint(args...)) }) ast.Inspect(f.parsed, f.inspect) }() return &f.File, err }
func TestParse(t *testing.T) { defer fail.Using(t.Fatal) builder, err := introspect.NewFileBuilder("testdata/test.go.src") fail.IfErr(err) f, err := builder.Build() fail.IfErr(err) j, err := json.MarshalIndent(f, "", " ") fail.IfErr(err) fmt.Println(string(j)) }