Skip to content

Commit b02fa23

Browse files
author
Dean Karn
committed
conversion interface{} to any
1 parent 91d148f commit b02fa23

File tree

3 files changed

+4
-48
lines changed

3 files changed

+4
-48
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
test:
99
strategy:
1010
matrix:
11-
go-version: [1.17.x, 1.18.x]
11+
go-version: [1.18.x]
1212
os: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:

lexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type LexerResult struct {
1515
// Token represents a lexed token with value
1616
type Token struct {
1717
kind TokenKind
18-
value interface{}
18+
value any
1919
}
2020

2121
// TokenKind is the type of token lexed.

parser.go

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -509,50 +509,6 @@ func (e eq) Calculate(src []byte) (any, error) {
509509
return reflect.DeepEqual(left, right), nil
510510
}
511511

512-
//func equals(left, right interface{}) (bool, error) {
513-
// reflect.DeepEqual()
514-
// if left == nil && right == nil {
515-
// return true, nil
516-
// } else if (left == nil && right != nil) || (left != nil && right == nil) {
517-
// return false, nil
518-
// }
519-
//
520-
// lv := reflect.ValueOf(left)
521-
// rv := reflect.ValueOf(right)
522-
//
523-
// if lv.IsZero() || rv.IsZero() {
524-
// return false, nil
525-
// }
526-
//
527-
// if lv.Type() != rv.Type() {
528-
// return false, nil
529-
// }
530-
//
531-
// if lv.Kind() == reflect.Array {
532-
// ra := right.([]interface{})
533-
// la := right.([]interface{})
534-
// if len(ra) != len(la) {
535-
// return false, nil
536-
// }
537-
// for i, r := range ra {
538-
// isEq, err := equals(la[i], r)
539-
// if err != nil {
540-
// return false, err
541-
// }
542-
// if !isEq {
543-
// return false, nil
544-
// }
545-
// }
546-
// return true, nil
547-
// } else if lv.Kind() == reflect.Map {
548-
//
549-
// }
550-
// if !lv.Type().Comparable() || !rv.Type().Comparable() {
551-
// return false, nil
552-
// }
553-
// return left == right, nil
554-
//}
555-
556512
var _ Expression = (*gt)(nil)
557513

558514
type gt struct {
@@ -858,7 +814,7 @@ func (i in) Calculate(src []byte) (any, error) {
858814
return nil, err
859815
}
860816

861-
arr, ok := right.([]interface{})
817+
arr, ok := right.([]any)
862818
if !ok {
863819
return nil, ErrUnsupportedTypeComparison{s: fmt.Sprintf("%s IN %s !", left, right)}
864820
}
@@ -877,7 +833,7 @@ type array struct {
877833
}
878834

879835
func (a array) Calculate(src []byte) (any, error) {
880-
arr := make([]interface{}, 0, len(a.vec))
836+
arr := make([]any, 0, len(a.vec))
881837
for _, v := range a.vec {
882838
res, err := v.Calculate(src)
883839
if err != nil {

0 commit comments

Comments
 (0)