Golang linter, lint that pass any slice as any in variadic function
go install github.com/alingse/asasalint/cmd/asasalint@latest
asasalint ./...
ignore some func that was by desgin
asasalint -e append,Append ./...
two kind of unexpected usage, and go build
success
package main
import "fmt"
func A(args ...any) int {
return len(args)
}
func B(args ...any) int {
return A(args)
}
func main() {
// 1
fmt.Println(B(1, 2, 3, 4))
}
package main
import "fmt"
func errMsg(msg string, args ...any) string {
return fmt.Sprintf(msg, args...)
}
func Err(msg string, args ...any) string {
return errMsg(msg, args)
}
func main() {
// p1 [hello world] p2 %!s(MISSING)
fmt.Println(Err("p1 %s p2 %s", "hello", "world"))
}
- given a SuggestEdition
- add
append
to default exclude ? - ingore pattern
fn(a, b, []any{1,2,3})
, because[]any{1,2,3}
is most likely by design