summaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/generate.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2018-08-23 22:51:56 +0200
committerOndrej Fabry <ofabry@cisco.com>2018-08-24 12:43:05 +0200
commit6b350c65fe0ec845cecf58bfb41ffc63dc9c04f7 (patch)
tree6255495854f43ec2f2d11f88990369aadb48db3f /cmd/binapi-generator/generate.go
parent892683bef86cacc2ccda2b4df2b079171bd92164 (diff)
Simplify subscribing to events and fix events
- there is no need for sending subscription requests through channels, since all the messages are registered and no communication with VPP is needed Change-Id: Ibc29957be02a32e26309f66c369a071559b822a9 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'cmd/binapi-generator/generate.go')
-rw-r--r--cmd/binapi-generator/generate.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go
index 33ab614..73bcd2a 100644
--- a/cmd/binapi-generator/generate.go
+++ b/cmd/binapi-generator/generate.go
@@ -140,9 +140,9 @@ func generatePackage(ctx *context, w *bufio.Writer) error {
if len(ctx.packageData.Services) > 0 {
fmt.Fprintf(w, "/* Services */\n\n")
- fmt.Fprintf(w, "type %s interface {\n", "Services")
ctx.inputBuff = bytes.NewBuffer(ctx.inputData)
ctx.inputLine = 0
+ fmt.Fprintf(w, "type %s interface {\n", "Services")
for _, svc := range ctx.packageData.Services {
generateService(ctx, w, &svc)
}
@@ -209,6 +209,7 @@ func generateImports(ctx *context, w io.Writer) {
fmt.Fprintln(w)
fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n")
+ fmt.Fprintf(w, "var _ = api.RegisterMessage\n")
fmt.Fprintf(w, "var _ = struc.Pack\n")
fmt.Fprintf(w, "var _ = bytes.NewBuffer\n")
fmt.Fprintln(w)