diff --git a/_examples/mexicanBar/main.go b/_examples/mexicanBar/main.go index 8b17bd1..8c2ecae 100644 --- a/_examples/mexicanBar/main.go +++ b/_examples/mexicanBar/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "math/rand" "time" @@ -17,20 +16,20 @@ name := "Complex Filler:" bs := mpb.BarStyle() bs = bs.LboundMeta(func(s string) string { - return fmt.Sprint("\033[34m", s, "\033[0m") // blue + return "\033[34m" + s + "\033[0m" // blue }) bs = bs.Filler("_").FillerMeta(func(s string) string { - return fmt.Sprint("\033[36m", s, "\033[0m") // cyan + return "\033[36m" + s + "\033[0m" // cyan }) bs = bs.Tip("⛵").TipMeta(func(s string) string { - return fmt.Sprint("\033[31m", s, "\033[0m") // red + return "\033[31m" + s + "\033[0m" // red }) bs = bs.TipOnComplete() // leave tip on complete bs = bs.Padding("_").PaddingMeta(func(s string) string { - return fmt.Sprint("\033[36m", s, "\033[0m") // cyan + return "\033[36m" + s + "\033[0m" // cyan }) bs = bs.RboundMeta(func(s string) string { - return fmt.Sprint("\033[34m", s, "\033[0m") // blue + return "\033[34m" + s + "\033[0m" // blue }) bar := p.New(int64(total), bs, mpb.PrependDecorators(decor.Name(name)), diff --git a/_examples/spinTipBar/main.go b/_examples/spinTipBar/main.go index 340ad97..62eab3f 100644 --- a/_examples/spinTipBar/main.go +++ b/_examples/spinTipBar/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "math/rand" "time" @@ -17,7 +16,7 @@ name := "Single Bar:" bar := p.New(int64(total), mpb.BarStyle().Tip(`-`, `\`, `|`, `/`).TipMeta(func(s string) string { - return fmt.Sprint("\033[31m", s, "\033[0m") // red + return "\033[31m" + s + "\033[0m" // red }), mpb.PrependDecorators(decor.Name(name)), mpb.AppendDecorators(decor.Percentage()), diff --git a/_examples/spinnerBar/main.go b/_examples/spinnerBar/main.go index c87560e..c564452 100644 --- a/_examples/spinnerBar/main.go +++ b/_examples/spinnerBar/main.go @@ -24,7 +24,7 @@ if cond { s := mpb.SpinnerStyle("∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙") return s.Meta(func(s string) string { - return fmt.Sprint("\033[31m", s, "\033[0m") // red + return "\033[31m" + s + "\033[0m" // red }) } return mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟") diff --git a/bar_filler_spinner.go b/bar_filler_spinner.go index fcd4353..c9fd463 100644 --- a/bar_filler_spinner.go +++ b/bar_filler_spinner.go @@ -1,7 +1,6 @@ package mpb import ( - "fmt" "io" "strings" @@ -75,15 +74,15 @@ switch s.position { case positionLeft: sf.position = func(frame string, padWidth int) string { - return fmt.Sprint(frame, strings.Repeat(" ", padWidth)) + return frame + strings.Repeat(" ", padWidth) } case positionRight: sf.position = func(frame string, padWidth int) string { - return fmt.Sprint(strings.Repeat(" ", padWidth), frame) + return strings.Repeat(" ", padWidth) + frame } default: sf.position = func(frame string, padWidth int) string { - return fmt.Sprint(strings.Repeat(" ", padWidth/2), frame, strings.Repeat(" ", padWidth/2+padWidth%2)) + return strings.Repeat(" ", padWidth/2) + frame + strings.Repeat(" ", padWidth/2+padWidth%2) } } return sf diff --git a/bar_test.go b/bar_test.go index 6e9fbfa..c5e0e70 100644 --- a/bar_test.go +++ b/bar_test.go @@ -249,7 +249,7 @@ decor.Meta( decor.Any(td1), func(s string) string { - return fmt.Sprint("\x1b[31;1m", s, "\x1b[0m") + return "\x1b[31;1m" + s + "\x1b[0m" }, ), ),