mirror of https://github.com/golang/go.git
Use ReplaceAll, TrimSuffix in log
This commit is contained in:
parent
010277f588
commit
da48f4dfd3
|
|
@ -1009,12 +1009,11 @@ func (c *common) FailNow() {
|
|||
// indentation and the final newline if necessary. It prefixes the string
|
||||
// with the file and line of the call site.
|
||||
func (c *common) log(s string) {
|
||||
if n := len(s); n > 0 && (string(s[n-1]) == "\n") {
|
||||
s = s[:n-1]
|
||||
}
|
||||
s = strings.TrimSuffix(s, "\n")
|
||||
|
||||
// Second and subsequent lines are indented 4 spaces. This is in addition to
|
||||
// the indentation provided by outputWriter.
|
||||
s = strings.Replace(s, "\n", fmt.Sprintf("\n%s", indent), -1)
|
||||
s = strings.ReplaceAll(s, "\n", fmt.Sprintf("\n%s", indent))
|
||||
s += "\n"
|
||||
|
||||
// Prefix with the call site. It is located by skipping 3 functions:
|
||||
|
|
|
|||
Loading…
Reference in New Issue