Canonicalize will simply read the metadata file and write it out
again. This may be useful after editing it by hand or with external
JSON tools, to put it back in "golang canonical" form.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
(Eventually this will be implemented by the `xsatool global
end-support [version]` command.)
+## 'Canonicalizing' metadata files
+
+After editing metadata files by hand or with other JSON-parsing tools,
+the order of fields may be signicantly different. You can run
+
+`xsatool NNN canonicalize`
+
+to reformat a file according to Golang's default format.
+
# Potential future functionality
## Automatically de-duplicating patches
checkXSARepos = false
case "dedup-patches":
main = MainDedupPatches
+ case "canonicalize":
+ main = MainCanonicalize
default:
fmt.Printf("Unknown command: %s\n", cmd)
return 1
return 0
}
+
+func MainCanonicalize(xsa *XSAMeta, args []string) (ret int) {
+ xsa.dirty = true
+
+ xsa.Save()
+
+ return 0
+}