Browse code

pkg/jsonmessage: fix SA1006: printf-style function with no arguments

Also fixed some incorrectly formatted comments

```
pkg/jsonmessage/jsonmessage.go:180:20: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
fmt.Fprintf(out, endl)
^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/10/13 00:35:13
Showing 1 changed files
... ...
@@ -139,13 +139,13 @@ type JSONMessage struct {
139 139
 	Stream          string        `json:"stream,omitempty"`
140 140
 	Status          string        `json:"status,omitempty"`
141 141
 	Progress        *JSONProgress `json:"progressDetail,omitempty"`
142
-	ProgressMessage string        `json:"progress,omitempty"` //deprecated
142
+	ProgressMessage string        `json:"progress,omitempty"` // deprecated
143 143
 	ID              string        `json:"id,omitempty"`
144 144
 	From            string        `json:"from,omitempty"`
145 145
 	Time            int64         `json:"time,omitempty"`
146 146
 	TimeNano        int64         `json:"timeNano,omitempty"`
147 147
 	Error           *JSONError    `json:"errorDetail,omitempty"`
148
-	ErrorMessage    string        `json:"error,omitempty"` //deprecated
148
+	ErrorMessage    string        `json:"error,omitempty"` // deprecated
149 149
 	// Aux contains out-of-band data, such as digests for push signing and image id after building.
150 150
 	Aux *json.RawMessage `json:"aux,omitempty"`
151 151
 }
... ...
@@ -177,7 +177,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
177 177
 	if isTerminal && jm.Stream == "" && jm.Progress != nil {
178 178
 		clearLine(out)
179 179
 		endl = "\r"
180
-		fmt.Fprintf(out, endl)
180
+		fmt.Fprint(out, endl)
181 181
 	} else if jm.Progress != nil && jm.Progress.String() != "" { //disable progressbar in non-terminal
182 182
 		return nil
183 183
 	}
... ...
@@ -194,7 +194,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
194 194
 	}
195 195
 	if jm.Progress != nil && isTerminal {
196 196
 		fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl)
197
-	} else if jm.ProgressMessage != "" { //deprecated
197
+	} else if jm.ProgressMessage != "" { // deprecated
198 198
 		fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
199 199
 	} else if jm.Stream != "" {
200 200
 		fmt.Fprintf(out, "%s%s", jm.Stream, endl)