-
Notifications
You must be signed in to change notification settings - Fork 345
/
main.go
54 lines (45 loc) · 1.17 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/amino/genproto"
"github.com/gnolang/gno/tm2/pkg/amino/genproto/example/submodule"
"github.com/gnolang/gno/tm2/pkg/amino/genproto/example/submodule2"
)
// amino
type StructA struct {
FieldC int
FieldD uint32
}
// amino
type StructB struct {
FieldC int
FieldD uint32
FieldE submodule.StructSM
FieldF StructA
FieldG interface{}
}
func main() {
packages := []*amino.Package{
submodule2.Package,
submodule.Package,
Package,
}
for i, pkg := range packages {
fmt.Println("#", i, "package path", pkg.GoPkgPath)
// Defined in genproto.go.
// These will generate .proto files next to
// their .go origins.
fmt.Println("#", i, "write proto3 schema")
genproto.WriteProto3Schema(pkg)
// Make proto folder for proto dependencies.
fmt.Println("#", i, "make proto folder")
genproto.MakeProtoFolder(pkg, "proto")
// Generate Go code from .proto files generated above.
fmt.Println("#", i, "run protoc")
genproto.RunProtoc(pkg, "proto")
// Generate bindings.go for other methods.
fmt.Println("#", i, "write proto bindings")
genproto.WriteProtoBindings(pkg)
}
}