diff --git a/chunks/chunk.go b/chunks/chunk.go index 9f2667a..a05eec9 100644 --- a/chunks/chunk.go +++ b/chunks/chunk.go @@ -42,6 +42,6 @@ const ( TextChunkType ChunkType = iota // TagChunkType is the type of a tag Chunk "{%…%}" TagChunkType - // TextChunkType is the type of an object Chunk "{{…}}" + // ObjChunkType is the type of an object Chunk "{{…}}" ObjChunkType ) diff --git a/expressions/scanner_test.go b/expressions/scanner_test.go index 3717320..63f8745 100644 --- a/expressions/scanner_test.go +++ b/expressions/scanner_test.go @@ -14,7 +14,7 @@ import ( // {"{{x}}", "1"}, // } -func ScanExpression(data string) ([]yySymType, error) { +func scanExpression(data string) ([]yySymType, error) { l := newLexer([]byte(data)) var symbols []yySymType var s yySymType @@ -29,7 +29,7 @@ func ScanExpression(data string) ([]yySymType, error) { } func TestExpressionScanner(t *testing.T) { - tokens, err := ScanExpression("abc > 123") + tokens, err := scanExpression("abc > 123") require.NoError(t, err) require.Len(t, tokens, 3) } diff --git a/filters/filters.go b/filters/filters.go index b19b25e..2c76d08 100644 --- a/filters/filters.go +++ b/filters/filters.go @@ -228,9 +228,7 @@ func reverseFilter(in []interface{}) interface{} { func sortFilter(in []interface{}, key interface{}) []interface{} { out := make([]interface{}, len(in)) - for i, v := range in { - out[i] = v - } + copy(out, in) if key == nil { generics.Sort(out) } else {