There is a standard format for generated Go code header comments, as set
by [1]. Modify gengotypes.py to follow this standard, and use the
additional
// source: <IDL file basename>
convention used by protoc-gen-go.
This change is motivated by the fact that since
41aea82de2, the comment
would include the absolute path to libxl_types.idl, therefore creating
unintended diffs when generating code across different machines. This
approach fixes that problem.
[1] https://github.com/golang/go/issues/13560
Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
name = b.typename
builtin_type_names[name] = xenlight_golang_fmt_name(name)
- header_comment="""// DO NOT EDIT.
-//
-// This file is generated by:
-// {0}
-//
+ header_comment="""// Code generated by {}. DO NOT EDIT.
+// source: {}
-""".format(' '.join(sys.argv))
+""".format(os.path.basename(sys.argv[0]),
+ ' '.join([os.path.basename(a) for a in sys.argv[1:]]))
xenlight_golang_generate_types(types=types,
comment=header_comment)
-// DO NOT EDIT.
-//
-// This file is generated by:
-// gengotypes.py ../../libxl/libxl_types.idl
-//
+// Code generated by gengotypes.py. DO NOT EDIT.
+// source: libxl_types.idl
package xenlight
-// DO NOT EDIT.
-//
-// This file is generated by:
-// gengotypes.py ../../libxl/libxl_types.idl
-//
+// Code generated by gengotypes.py. DO NOT EDIT.
+// source: libxl_types.idl
package xenlight