aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/generate.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-06-12 18:37:20 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-06-12 19:41:35 +0200
commit682250e328472e855a4c59e9e5f004473b6af0d3 (patch)
tree6de85c22a2d18a83ba05f2713c75c9d089c6275b /cmd/binapi-generator/generate.go
parentc4522fe10317b1729a0820dc880afc78c663f64d (diff)
Fix parsing API with removed CRC for types and unions
- method GetCrcString() was also removed from DataType interface - fix generated comment for services - fix permissions for created files and directories Change-Id: If0b7a57e01f1128b5ba574fc5ee13b6a7c6aa6fd Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'cmd/binapi-generator/generate.go')
-rw-r--r--cmd/binapi-generator/generate.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go
index d9555e7..1ff3e4c 100644
--- a/cmd/binapi-generator/generate.go
+++ b/cmd/binapi-generator/generate.go
@@ -256,7 +256,7 @@ func generateImports(ctx *context, w io.Writer) {
// generateComment writes generated comment for the object into w
func generateComment(ctx *context, w io.Writer, goName string, vppName string, objKind string) {
if objKind == "service" {
- fmt.Fprintf(w, "// %s represents VPP binary API services in %s module.\n", ctx.moduleName, goName)
+ fmt.Fprintf(w, "// %s represents VPP binary API services in %s module.\n", goName, ctx.moduleName)
} else {
fmt.Fprintf(w, "// %s represents VPP binary API %s '%s':\n", goName, objKind, vppName)
}
@@ -497,7 +497,9 @@ func generateUnion(ctx *context, w io.Writer, union *Union) {
generateTypeNameGetter(w, name, union.Name)
// generate CRC getter
- generateCrcGetter(w, name, union.CRC)
+ if union.CRC != "" {
+ generateCrcGetter(w, name, union.CRC)
+ }
// generate getters for fields
for _, field := range union.Fields {
@@ -589,7 +591,9 @@ func generateType(ctx *context, w io.Writer, typ *Type) {
generateTypeNameGetter(w, name, typ.Name)
// generate CRC getter
- generateCrcGetter(w, name, typ.CRC)
+ if typ.CRC != "" {
+ generateCrcGetter(w, name, typ.CRC)
+ }
fmt.Fprintln(w)
}