update linter

This commit is contained in:
andrey
2025-11-21 11:58:20 +03:00
parent 22dacb741f
commit 72ef747541
25 changed files with 156 additions and 144 deletions

View File

@@ -5,7 +5,7 @@ import (
"testing"
)
func Equal(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
func Equal(t *testing.T, expected any, actual any, msgAndArgs ...any) bool {
t.Helper()
if reflect.DeepEqual(expected, actual) {
@@ -17,7 +17,7 @@ func Equal(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ..
return false
}
func Equalf(t *testing.T, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
func Equalf(t *testing.T, expected any, actual any, msg string, args ...any) bool {
t.Helper()
if reflect.DeepEqual(expected, actual) {

View File

@@ -2,7 +2,7 @@ package assert
import "testing"
func Nil(t *testing.T, data any, msgAndArgs ...interface{}) bool {
func Nil(t *testing.T, data any, msgAndArgs ...any) bool {
t.Helper()
if data != nil {

View File

@@ -49,7 +49,7 @@ func NewReadConfig(key ...string) Read {
return NewReadUnmarshal(ex, &Config{}, key...)
}
func NewReadUnmarshal(expected, target interface{}, key ...string) Read {
func NewReadUnmarshal(expected, target any, key ...string) Read {
return Read{
Key: key,
Assert: func(t *testing.T, v config.Value) {
@@ -66,17 +66,21 @@ func Time(value string) time.Time {
return t
}
// nolint: cyclop
func NewRead(expected interface{}, key ...string) Read {
// NewRead test data.
//
//nolint:cyclop
func NewRead(expected any, key ...string) Read {
return Read{
Key: key,
Assert: func(t *testing.T, v config.Value) {
t.Helper()
var (
val interface{}
val any
err error
short interface{}
short any
)
switch expected.(type) {
case bool:
val, err = v.ParseBool()

View File

@@ -6,7 +6,7 @@ import (
"gitoa.ru/go-4devs/config/test/assert"
)
func Equal(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
func Equal(t *testing.T, expected any, actual any, msgAndArgs ...any) {
t.Helper()
if assert.Equal(t, expected, actual, msgAndArgs...) {
@@ -16,7 +16,7 @@ func Equal(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ..
t.FailNow()
}
func Equalf(t *testing.T, expected interface{}, actual interface{}, msg string, args ...interface{}) {
func Equalf(t *testing.T, expected any, actual any, msg string, args ...any) {
t.Helper()
if assert.Equalf(t, expected, actual, msg, args...) {

View File

@@ -4,7 +4,7 @@ import (
"testing"
)
func NoError(t *testing.T, err error, msgAndArgs ...interface{}) {
func NoError(t *testing.T, err error, msgAndArgs ...any) {
t.Helper()
if err != nil {
@@ -13,7 +13,7 @@ func NoError(t *testing.T, err error, msgAndArgs ...interface{}) {
}
}
func NoErrorf(t *testing.T, err error, msg string, args ...interface{}) {
func NoErrorf(t *testing.T, err error, msg string, args ...any) {
t.Helper()
if err != nil {

View File

@@ -2,7 +2,7 @@ package require
import "testing"
func Fail(t *testing.T, msg string, args ...interface{}) {
func Fail(t *testing.T, msg string, args ...any) {
t.Helper()
t.Errorf(msg, args...)
t.FailNow()

View File

@@ -4,7 +4,7 @@ import (
"testing"
)
func Truef(t *testing.T, value bool, msg string, args ...interface{}) {
func Truef(t *testing.T, value bool, msg string, args ...any) {
t.Helper()
if !value {