Skip to content

Commit

Permalink
#234 Fixed issue found by golang linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhang6222 committed May 22, 2020
1 parent ea9149c commit 8c81c1f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions syntax/std_seq.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func stdSeq() rel.Attr {
}),
createNestedFuncAttr("sub", 3, func(args ...rel.Value) rel.Value {
old, new, subject := args[0], args[1], args[2]
switch subject.(type) {
switch subject := subject.(type) {
case rel.String:
return rel.NewString(
[]rune(
Expand All @@ -123,7 +123,7 @@ func stdSeq() rel.Attr {
),
)
case rel.Array:
return arraySub(old, new, subject.(rel.Array))
return arraySub(old, new, subject)
case rel.Bytes:
_, oldIsSet := old.(rel.GenericSet)
_, newIsSet := new.(rel.GenericSet)
Expand Down Expand Up @@ -152,7 +152,7 @@ func stdSeq() rel.Attr {
}),
createNestedFuncAttr("split", 2, func(args ...rel.Value) rel.Value {
delimiter, subject := args[0], args[1]
switch subject.(type) {
switch subject := subject.(type) {
case rel.String:
splitted := strings.Split(mustAsString(subject), mustAsString(delimiter))
vals := make([]rel.Value, 0, len(splitted))
Expand All @@ -161,9 +161,9 @@ func stdSeq() rel.Attr {
}
return rel.NewArray(vals...)
case rel.Array:
return arraySplit(delimiter, subject.(rel.Array))
return arraySplit(delimiter, subject)
case rel.Bytes:
return bytesSplit(delimiter, subject.(rel.Bytes))
return bytesSplit(delimiter, subject)
case rel.GenericSet:
switch delimiter.(type) {
case rel.String:
Expand All @@ -178,8 +178,8 @@ func stdSeq() rel.Attr {
panic(fmt.Errorf("split: unsupported args: %s, %s", delimiter, subject))
}),
createNestedFuncAttr("join", 2, func(args ...rel.Value) rel.Value {
joiner, subjectParam := args[0], args[1]
switch subject := subjectParam.(type) {
joiner, subject := args[0], args[1]
switch subject := subject.(type) {
case rel.Array:
switch subject.Values()[0].(type) {
case rel.String:
Expand All @@ -206,7 +206,7 @@ func stdSeq() rel.Attr {
}
}

panic(fmt.Errorf("join: unsupported args: %s, %s", joiner, subjectParam))
panic(fmt.Errorf("join: unsupported args: %s, %s", joiner, subject))
}),
)
}
Expand Down

0 comments on commit 8c81c1f

Please sign in to comment.