Commit 44a8642a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b54a37a1
......@@ -7,6 +7,6 @@ type Header struct {
}
type Notify struct {
// Header
Header
Message string
}
// TODO text what it does (generates code for pkt.go)
// +build ignore
package main
import (
......@@ -20,7 +24,9 @@ func main() {
ncode := 0
//ast.Print(fset, f)
// ast.Print(fset, f)
// return
for _, decl := range f.Decls {
// we look for types (which can be only under GenDecl)
gdecl, ok := decl.(*ast.GenDecl)
......@@ -57,8 +63,13 @@ func main() {
panic(fmt.Sprintf("%#v not supported", fieldv.Type))
}
for _, field := range fieldv.Names {
fmt.Printf("%s(%d).%s\t%s\n", tname, ncode, field.Name, ftype)
if len(fieldv.Names) != 0 {
for _, field := range fieldv.Names {
fmt.Printf("%s(%d).%s\t%s\n", tname, ncode, field.Name, ftype)
}
} else {
// no names means embedding
fmt.Printf("%s(%d).<%s>\n", tname, ncode, ftype)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment