Skip to content

Commit f84e2c2

Browse files
Update a gopls modernizer recommendation (#79)
* Update a gopls modernizer recommendation * Use hue's Text method for slightly faster colouring
1 parent 1dd0afc commit f84e2c2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,18 @@ func CaptureOutput(tb testing.TB, fn func() error) (stdout, stderr string) {
491491
// prettyDiff takes a string diff in unified diff format and colourises it for easier viewing.
492492
func prettyDiff(diff string) string {
493493
lines := strings.Split(diff, "\n")
494-
for i := 0; i < len(lines); i++ {
494+
for i := range lines {
495495
trimmed := strings.TrimSpace(lines[i])
496496
if strings.HasPrefix(trimmed, "---") || strings.HasPrefix(trimmed, "- ") {
497-
lines[i] = red.Sprint(lines[i])
497+
lines[i] = red.Text(lines[i])
498498
}
499499

500500
if strings.HasPrefix(trimmed, "@@") {
501-
lines[i] = header.Sprint(lines[i])
501+
lines[i] = header.Text(lines[i])
502502
}
503503

504504
if strings.HasPrefix(trimmed, "+++") || strings.HasPrefix(trimmed, "+ ") {
505-
lines[i] = green.Sprint(lines[i])
505+
lines[i] = green.Text(lines[i])
506506
}
507507
}
508508

0 commit comments

Comments
 (0)