mirror of
https://github.com/mgechev/revive.git
synced 2025-12-01 22:30:16 +02:00
fix(color): moved global color calls to separate functions
There is an initialization order issue when forcing colorizing. Every calls from the fatich/color package must be done by a function not during global variable initialization.
This commit is contained in:
committed by
Minko Gechev
parent
3bba955563
commit
2e98c7c63a
14
main.go
14
main.go
@@ -9,19 +9,25 @@ import (
|
||||
"github.com/mgechev/revive/lint"
|
||||
)
|
||||
|
||||
var logo = color.YellowString(` _ __ _____ _(_)__ _____
|
||||
func getLogo() string {
|
||||
return color.YellowString(` _ __ _____ _(_)__ _____
|
||||
| '__/ _ \ \ / / \ \ / / _ \
|
||||
| | | __/\ V /| |\ V / __/
|
||||
|_| \___| \_/ |_| \_/ \___|`)
|
||||
}
|
||||
|
||||
var call = color.MagentaString("revive -config c.toml -formatter friendly -exclude a.go -exclude b.go ./...")
|
||||
func getCall() string {
|
||||
return color.MagentaString("revive -config c.toml -formatter friendly -exclude a.go -exclude b.go ./...")
|
||||
}
|
||||
|
||||
var banner = fmt.Sprintf(`
|
||||
func getBanner() string {
|
||||
return fmt.Sprintf(`
|
||||
%s
|
||||
|
||||
Example:
|
||||
%s
|
||||
`, logo, call)
|
||||
`, getLogo(), getCall())
|
||||
}
|
||||
|
||||
func main() {
|
||||
config := getConfig()
|
||||
|
||||
Reference in New Issue
Block a user