Skip to content

Commit

Permalink
interface{} -> any
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Feb 24, 2024
1 parent 6f626c7 commit 2af2306
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func strPtr(s string) *string {
return &s2
}

func newTestState(patternArg interface{}) *passgen.State {
func newTestState(patternArg any) *passgen.State {
var pattern []rune
switch patternTyped := patternArg.(type) {
case string:
Expand Down Expand Up @@ -56,5 +56,5 @@ type genCase struct {
type genErrCase struct {
Pattern string

Error interface{}
Error any
}
6 changes: 3 additions & 3 deletions lib/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestGenerate(t *testing.T) {
is.Equal(actual, tc.WordCount)
}
}
checkErrorIsInList := func(is *is.Is, err error, expMsgs []interface{}) {
checkErrorIsInList := func(is *is.Is, err error, expMsgs []any) {
if !is.Err(err) {
return
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func TestGenerate(t *testing.T) {
} else {
is.ErrMsg(err, expErr)
}
case []interface{}:
case []any:
checkErrorIsInList(is, err, expErr)
case *passgen.Error:
is.Equal(tErr.Type(), expErr.Type())
Expand Down Expand Up @@ -698,7 +698,7 @@ func TestGenerate(t *testing.T) {
testErr(&genErrCase{
// FIXME: if one part of alteration has no error, test becomes flaky
Pattern: `([:foobar1:]|[:foobar2:])`,
Error: []interface{}{
Error: []any{
`value error near index 9: invalid character class "foobar1"`,
`value error near index 20: invalid character class "foobar2"`,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/repeat_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ilius/is/v2"
)

func newTestState(patternArg interface{}) *State {
func newTestState(patternArg any) *State {
var pattern []rune
switch patternTyped := patternArg.(type) {
case string:
Expand Down
8 changes: 4 additions & 4 deletions lib/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,31 +101,31 @@ func (s *State) getErrorPos() uint {
return uint(pos)
}

func (s *State) errorSyntax(msg string, args ...interface{}) error {
func (s *State) errorSyntax(msg string, args ...any) error {
return NewError(
ErrorSyntax,
s.getErrorPos(),
fmt.Sprintf(msg, args...),
).WithMarkLen(s.errorMarkLen)
}

func (s *State) errorArg(msg string, args ...interface{}) error {
func (s *State) errorArg(msg string, args ...any) error {
return NewError(
ErrorArg,
s.getErrorPos(),
fmt.Sprintf(msg, args...),
).WithMarkLen(s.errorMarkLen)
}

func (s *State) errorValue(msg string, args ...interface{}) error {
func (s *State) errorValue(msg string, args ...any) error {
return NewError(
ErrorValue,
s.getErrorPos(),
fmt.Sprintf(msg, args...),
).WithMarkLen(s.errorMarkLen)
}

func (s *State) errorUnknown(msg string, args ...interface{}) error {
func (s *State) errorUnknown(msg string, args ...any) error {
return NewError(
ErrorUnknown,
s.getErrorPos(),
Expand Down

0 comments on commit 2af2306

Please sign in to comment.