Skip to content

Commit 031eb8b

Browse files
committed
Don't add system characters to user's messages
1 parent c97a22f commit 031eb8b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

logger_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func TestEchoWithTextFormatting(t *testing.T) {
110110
name: "System formatStr",
111111
format: formatStr,
112112
in: []interface{}{"hello", "world"},
113-
want: " helloworld ", // ads space of the end, used fmt.Print
113+
want: "helloworld", // used fmt.Print
114114
},
115115
{
116116
name: "System formatStrLn",

tools.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ func textMessage(
148148
case f == "":
149149
fallthrough
150150
case f == formatStr:
151-
msg = fmt.Sprintf("%s%s%s", sb.String(), fmt.Sprint(a...), o.Space)
151+
// For messages that are output on the same line, the task of
152+
// separating the messages falls on the user. We don't need to
153+
// add extra characters to user messages.
154+
// msg = fmt.Sprintf("%s%s%s", sb.String(), fmt.Sprint(a...), o.Space)
155+
msg = fmt.Sprintf("%s%s", sb.String(), fmt.Sprint(a...))
152156
case f == formatStrLn:
153157
msg = fmt.Sprintf("%s%s", sb.String(), fmt.Sprintln(a...))
154158
default:

0 commit comments

Comments
 (0)