1
0
mirror of https://github.com/go-task/task.git synced 2025-08-08 22:36:57 +02:00

refactor: enable gofmt linter and fix all issues

- also rewrite 'interface{}' as 'any'
This commit is contained in:
Pete Davison
2023-03-30 20:03:59 +00:00
committed by Andrey Nering
parent a6d57496c2
commit aab51c331f
12 changed files with 41 additions and 36 deletions

View File

@ -9,7 +9,7 @@ import (
)
type Color func() PrintFunc
type PrintFunc func(io.Writer, string, ...interface{})
type PrintFunc func(io.Writer, string, ...any)
func Default() PrintFunc {
return color.New(envColor("TASK_COLOR_RESET", color.Reset)).FprintfFunc()
@ -56,14 +56,14 @@ type Logger struct {
}
// Outf prints stuff to STDOUT.
func (l *Logger) Outf(color Color, s string, args ...interface{}) {
func (l *Logger) Outf(color Color, s string, args ...any) {
l.FOutf(l.Stdout, color, s+"\n", args...)
}
// FOutf prints stuff to the given writer.
func (l *Logger) FOutf(w io.Writer, color Color, s string, args ...interface{}) {
func (l *Logger) FOutf(w io.Writer, color Color, s string, args ...any) {
if len(args) == 0 {
s, args = "%s", []interface{}{s}
s, args = "%s", []any{s}
}
if !l.Color {
color = Default
@ -73,16 +73,16 @@ func (l *Logger) FOutf(w io.Writer, color Color, s string, args ...interface{})
}
// VerboseOutf prints stuff to STDOUT if verbose mode is enabled.
func (l *Logger) VerboseOutf(color Color, s string, args ...interface{}) {
func (l *Logger) VerboseOutf(color Color, s string, args ...any) {
if l.Verbose {
l.Outf(color, s, args...)
}
}
// Errf prints stuff to STDERR.
func (l *Logger) Errf(color Color, s string, args ...interface{}) {
func (l *Logger) Errf(color Color, s string, args ...any) {
if len(args) == 0 {
s, args = "%s", []interface{}{s}
s, args = "%s", []any{s}
}
if !l.Color {
color = Default
@ -92,7 +92,7 @@ func (l *Logger) Errf(color Color, s string, args ...interface{}) {
}
// VerboseErrf prints stuff to STDERR if verbose mode is enabled.
func (l *Logger) VerboseErrf(color Color, s string, args ...interface{}) {
func (l *Logger) VerboseErrf(color Color, s string, args ...any) {
if l.Verbose {
l.Errf(color, s, args...)
}