cue/format: always remove space before ':'
Out of laziness, also fixed typo in other file.
Change-Id: I3fe714230134ec7ea0ffaf833cd078a855622541
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5181
Reviewed-by: roger peppe <rogpeppe@gmail.com>
diff --git a/cue/build.go b/cue/build.go
index 5116825..5f7aa62 100644
--- a/cue/build.go
+++ b/cue/build.go
@@ -156,7 +156,7 @@
// may be incomplete, in which case its Err field is set.
//
// Example:
-// inst := cue.Build(load.Load(args))
+// inst := cue.Build(load.Instances(args))
//
func Build(instances []*build.Instance) []*Instance {
if len(instances) == 0 {
diff --git a/cue/format/node.go b/cue/format/node.go
index 6400cc0..d306d70 100644
--- a/cue/format/node.go
+++ b/cue/format/node.go
@@ -250,7 +250,7 @@
regular := isRegularField(n.Token)
if regular {
- f.print(n.TokenPos, token.COLON)
+ f.print(noblank, nooverride, n.TokenPos, token.COLON)
} else {
f.print(blank, nooverride, n.Token)
}
diff --git a/cue/format/testdata/expressions.golden b/cue/format/testdata/expressions.golden
index 64123e4..5ed1f18 100644
--- a/cue/format/testdata/expressions.golden
+++ b/cue/format/testdata/expressions.golden
@@ -208,4 +208,6 @@
f: 3
a: [1, 2, // add comma
]
+
+ foo: bar
}
diff --git a/cue/format/testdata/expressions.input b/cue/format/testdata/expressions.input
index 4250966..3ea84a8 100644
--- a/cue/format/testdata/expressions.input
+++ b/cue/format/testdata/expressions.input
@@ -204,4 +204,6 @@
f: 3
a: [1, 2 // add comma
]
+
+ foo : bar
}
\ No newline at end of file