You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/02/12 20:37:18 UTC

[3/3] incubator-mynewt-newt git commit: Prettify json in manifest file.

Prettify json in manifest file.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/89f514c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/89f514c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/89f514c7

Branch: refs/heads/master
Commit: 89f514c7701d30efe70a67f6c7e7dde9461a7580
Parents: 93b3b5e
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Feb 12 11:36:47 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Feb 12 11:36:47 2016 -0800

----------------------------------------------------------------------
 newt/cli/image.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/89f514c7/newt/cli/image.go
----------------------------------------------------------------------
diff --git a/newt/cli/image.go b/newt/cli/image.go
index 37885f1..69da2d3 100644
--- a/newt/cli/image.go
+++ b/newt/cli/image.go
@@ -305,9 +305,14 @@ func (image *Image) CreateManifest() error {
 		return NewNewtError(fmt.Sprintf("Cannot create manifest file %s: %s",
 			image.ManifestFile, err.Error()))
 	}
+	defer file.Close()
 
-	encoder := json.NewEncoder(file)
-	err = encoder.Encode(manifest)
+	buffer, err := json.MarshalIndent(manifest, "", "  ")
+	if err != nil {
+		return NewNewtError(fmt.Sprintf("Cannot encode manifest: %s",
+			err.Error()))
+	}
+	_, err = file.Write(buffer)
 	if err != nil {
 		return NewNewtError(fmt.Sprintf("Cannot write manifest file: %s",
 			err.Error()))