Skip to content

Commit 16bbf5d

Browse files
committed
cli/command/container: cidFile.Write: include CID in error message
Include the container-ID in the error message when failing to write the ID to a file, so that the user can still find the ID of the container that was created. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent d5ed037 commit 16bbf5d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cli/command/container/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ func (cid *cidFile) Write(id string) error {
188188
if cid.file == nil {
189189
return nil
190190
}
191-
if _, err := cid.file.Write([]byte(id)); err != nil {
192-
return fmt.Errorf("failed to write the container ID to the file: %w", err)
191+
if _, err := cid.file.WriteString(id); err != nil {
192+
return fmt.Errorf("failed to write the container ID (%s) to file: %w", id, err)
193193
}
194194
cid.written = true
195195
return nil

0 commit comments

Comments
 (0)