chore: make go vet happy.

This commit is contained in:
Alexandre Pujol 2024-08-20 19:07:56 +01:00
parent 93313422bd
commit 4f4e373877
Failed to generate hash of commit
6 changed files with 23 additions and 23 deletions

View file

@ -199,7 +199,7 @@ func main() {
case format:
files, err = pathsFromArgs()
if err != nil {
logging.Fatal(err.Error())
logging.Fatal("%s", err.Error())
}
err = aaFormat(files)
case tree:
@ -207,6 +207,6 @@ func main() {
}
if err != nil {
logging.Fatal(err.Error())
logging.Fatal("%s", err.Error())
}
}

View file

@ -91,6 +91,6 @@ func main() {
os.Exit(0)
}
if err := aaPrebuild(); err != nil {
logging.Fatal(err.Error())
logging.Fatal("%s", err.Error())
}
}

View file

@ -37,7 +37,7 @@ func Print(msg string, a ...interface{}) int {
// Println prints a formatted message. Arguments are handled in the manner of fmt.Println.
func Println(msg string) int {
n, _ := fmt.Fprintf(os.Stdout, msg+"\n")
n, _ := fmt.Fprintf(os.Stdout, "%s\n", msg)
return n
}
@ -48,7 +48,7 @@ func Bulletf(msg string, a ...interface{}) string {
// Bullet prints a formatted bullet point string
func Bullet(msg string, a ...interface{}) int {
return Print(Bulletf(msg, a...))
return Print("%s", Bulletf(msg, a...))
}
// Stepf returns a formatted step string
@ -58,7 +58,7 @@ func Stepf(msg string, a ...interface{}) string {
// Step prints a step title
func Step(msg string, a ...interface{}) int {
return Print(Stepf(msg, a...))
return Print("%s", Stepf(msg, a...))
}
// Successf returns a formatted success string
@ -68,7 +68,7 @@ func Successf(msg string, a ...interface{}) string {
// Success prints a formatted success message to stdout
func Success(msg string, a ...interface{}) int {
return Print(Successf(msg, a...))
return Print("%s", Successf(msg, a...))
}
// Warningf returns a formatted warning string
@ -78,12 +78,12 @@ func Warningf(msg string, a ...interface{}) string {
// Warning prints a formatted warning message to stdout
func Warning(msg string, a ...interface{}) int {
return Print(Warningf(msg, a...))
return Print("%s", Warningf(msg, a...))
}
// Fatalf returns a formatted error message
func Error(msg string, a ...interface{}) int {
return Print(fmt.Sprintf("%s%s%s\n", Indent, errorText, fmt.Sprintf(msg, a...)))
return Print("%s", fmt.Sprintf("%s%s%s\n", Indent, errorText, fmt.Sprintf(msg, a...)))
}
// Fatalf returns a formatted error message

View file

@ -10,7 +10,7 @@ func TestPrint(t *testing.T) {
msg := "Print message"
wantN := 13
gotN := Print(msg)
gotN := Print("%s", msg)
if gotN != wantN {
t.Errorf("Print() = %v, want %v", gotN, wantN)
}
@ -28,7 +28,7 @@ func TestPrintln(t *testing.T) {
func TestBulletf(t *testing.T) {
msg := "Bullet message"
want := "\033[1m ⋅ \033[0mBullet message\n"
if got := Bulletf(msg); got != want {
if got := Bulletf("%s", msg); got != want {
t.Errorf("Bulletf() = %v, want %v", got, want)
}
}
@ -36,7 +36,7 @@ func TestBulletf(t *testing.T) {
func TestBullet(t *testing.T) {
msg := "Bullet message"
wantN := 28
gotN := Bullet(msg)
gotN := Bullet("%s", msg)
if gotN != wantN {
t.Errorf("Bullet() = %v, want %v", gotN, wantN)
}
@ -45,7 +45,7 @@ func TestBullet(t *testing.T) {
func TestStepf(t *testing.T) {
msg := "Step message"
want := "\033[1;32mStep message\033[0m\n"
if got := Stepf(msg); got != want {
if got := Stepf("%s", msg); got != want {
t.Errorf("Stepf() = %v, want %v", got, want)
}
}
@ -53,7 +53,7 @@ func TestStepf(t *testing.T) {
func TestStep(t *testing.T) {
msg := "Step message"
wantN := 24
gotN := Step(msg)
gotN := Step("%s", msg)
if gotN != wantN {
t.Errorf("Step() = %v, want %v", gotN, wantN)
}
@ -62,7 +62,7 @@ func TestStep(t *testing.T) {
func TestSuccessf(t *testing.T) {
msg := "Success message"
want := "\033[1;32m ✓ \033[0mSuccess message\n"
if got := Successf(msg); got != want {
if got := Successf("%s", msg); got != want {
t.Errorf("Successf() = %v, want %v", got, want)
}
}
@ -70,7 +70,7 @@ func TestSuccessf(t *testing.T) {
func TestSuccess(t *testing.T) {
msg := "Success message"
wantN := 32
gotN := Success(msg)
gotN := Success("%s", msg)
if gotN != wantN {
t.Errorf("Success() = %v, want %v", gotN, wantN)
}
@ -79,7 +79,7 @@ func TestSuccess(t *testing.T) {
func TestWarningf(t *testing.T) {
msg := "Warning message"
want := "\033[1;33m ‼ \033[0mWarning message\n"
if got := Warningf(msg); got != want {
if got := Warningf("%s", msg); got != want {
t.Errorf("Warningf() = %v, want %v", got, want)
}
}
@ -87,7 +87,7 @@ func TestWarningf(t *testing.T) {
func TestWarning(t *testing.T) {
msg := "Warning message"
wantN := 32
gotN := Warning(msg)
gotN := Warning("%s", msg)
if gotN != wantN {
t.Errorf("Warning() = %v, want %v", gotN, wantN)
}
@ -96,7 +96,7 @@ func TestWarning(t *testing.T) {
func TestError(t *testing.T) {
msg := "Error message"
wantN := 30
gotN := Error(msg)
gotN := Error("%s", msg)
if gotN != wantN {
t.Errorf("Error() = %v, want %v", gotN, wantN)
}
@ -105,7 +105,7 @@ func TestError(t *testing.T) {
func TestFatalf(t *testing.T) {
msg := "Error message"
want := "\033[1;31m ✗ Error: \033[0mError message\n"
if got := Fatalf(msg); got != want {
if got := Fatalf("%s", msg); got != want {
t.Errorf("Fatalf() = %v, want %v", got, want)
}
}

View file

@ -197,6 +197,6 @@ func main() {
os.Exit(1)
}
if err != nil {
logging.Fatal(err.Error())
logging.Fatal("%s", err.Error())
}
}

View file

@ -102,13 +102,13 @@ func (t *Test) Run(dryRun bool) (ran int, nb int, err error) {
if !strings.Contains(cmd, "{{") {
nb++
if dryRun {
logging.Bullet(cmd)
logging.Bullet("%s", cmd)
} else {
cmdErr := t.run(cmd, strings.Join(test.Stdin, "\n"))
if cmdErr != nil {
logging.Error("%v", cmdErr)
} else {
logging.Success(cmd)
logging.Success("%s", cmd)
}
}
}