golangci-lint/test/testdata/errorlint_errorf.go
dependabot[bot] ccf802550e
build(deps): bump github.com/polyfloyd/go-errorlint from 1.2.0 to 1.3.0 (#3675)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-03-12 13:13:56 +01:00

27 lines
683 B
Go

//golangcitest:args -Eerrorlint
//golangcitest:config_path testdata/configs/errorlint_errorf.yml
package testdata
import (
"errors"
"fmt"
)
type customError struct{}
func (customError) Error() string {
return "oops"
}
func errorLintErrorf() {
err := errors.New("oops")
fmt.Errorf("error: %w", err)
fmt.Errorf("error: %v", err) // want "non-wrapping format verb for fmt.Errorf. Use `%w` to format errors"
fmt.Errorf("%v %v", err, err) // want "non-wrapping format verb for fmt.Errorf. Use `%w` to format errors"
fmt.Errorf("error: %s", err.Error())
customError := customError{}
fmt.Errorf("error: %s", customError.Error())
strErr := "oops"
fmt.Errorf("%v", strErr)
}