Skip to content

Commit ec8747e

Browse files
committed
fixed bugs due to golang update
1 parent 1b560ba commit ec8747e

5 files changed

Lines changed: 37 additions & 40 deletions

File tree

env/docker/Dockerfile.buildbase

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ COPY src/go.mod /tmp/src/go.mod
77
COPY src/go.sum /tmp/src/go.sum
88

99
RUN apt-get update && apt-get install -y --no-install-recommends \
10-
sudo lsb-release ca-certificates \
10+
sudo lsb-release ca-certificates unzip cmake \
1111
&& rm -rf /var/lib/apt/lists/*
1212

1313
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh --directory-prefix=/usr/bin \

src/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/lib/pq v1.10.2
2424
github.com/oschwald/geoip2-golang v1.3.0
2525
github.com/sirupsen/logrus v1.9.1
26-
gocv.io/x/gocv v0.39.0
26+
gocv.io/x/gocv v0.42.0
2727
golang.org/x/crypto v0.45.0
2828
golang.org/x/oauth2 v0.27.0
2929
gopkg.in/h2non/bimg.v1 v1.0.19

src/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
259259
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
260260
gocv.io/x/gocv v0.39.0 h1:vWHupDE22LebZW6id2mVeT767j1YS8WqGt+ZiV7XJXE=
261261
gocv.io/x/gocv v0.39.0/go.mod h1:zYdWMj29WAEznM3Y8NsU3A0TRq/wR/cy75jeUypThqU=
262+
gocv.io/x/gocv v0.42.0 h1:AAsrFJH2aIsQHukkCovWqj0MCGZleQpVyf5gNVRXjQI=
263+
gocv.io/x/gocv v0.42.0/go.mod h1:zYdWMj29WAEznM3Y8NsU3A0TRq/wR/cy75jeUypThqU=
262264
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
263265
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
264266
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=

src/parser/parser_test.go

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package parser
22

33
import (
4-
"testing"
5-
"reflect"
6-
"runtime"
74
"fmt"
85
"path/filepath"
6+
"reflect"
7+
"runtime"
98
"strings"
9+
"testing"
1010
)
1111

1212
// ok fails the test if an err is not nil.
@@ -36,64 +36,63 @@ func equals(tb testing.TB, exp, act interface{}) {
3636
}
3737
}
3838

39-
40-
func TestParserCorrect(t *testing.T) {
39+
func TestParserCorrect(t *testing.T) {
4140
queryParser := NewQueryParser("a & b & c")
4241
_, err := queryParser.Parse(1)
4342
if err != nil {
44-
t.Errorf(err.Error())
43+
t.Errorf("%s", err.Error())
4544
}
4645
}
4746

48-
func TestParserIncorrectSyntax(t *testing.T) {
47+
func TestParserIncorrectSyntax(t *testing.T) {
4948
queryParser := NewQueryParser("a & b & |")
5049
_, err := queryParser.Parse(1)
5150
if err == nil {
5251
t.Errorf("Expected not nil, but got nil")
5352
}
5453
}
5554

56-
func TestParserIncorrectSyntax2(t *testing.T) {
55+
func TestParserIncorrectSyntax2(t *testing.T) {
5756
queryParser := NewQueryParser("a |")
5857
_, err := queryParser.Parse(1)
5958
if err == nil {
6059
t.Errorf("Expected not nil, but got nil")
6160
}
6261
}
6362

64-
func TestParserIncorrectBrackets(t *testing.T) {
63+
func TestParserIncorrectBrackets(t *testing.T) {
6564
queryParser := NewQueryParser("a & b & )")
6665
_, err := queryParser.Parse(1)
6766
if err == nil {
6867
t.Errorf("Expected not nil, but got nil")
6968
}
7069
}
7170

72-
func TestParserIncorrectLength(t *testing.T) {
71+
func TestParserIncorrectLength(t *testing.T) {
7372
queryParser := NewQueryParser("a & b & c & d & e & f & f & g & h & z & u)")
7473
_, err := queryParser.Parse(1)
7574
if err == nil {
7675
t.Errorf("Expected not nil, but got nil")
7776
}
7877
}
7978

80-
func TestParserKeepWhitespacesInAssigment(t *testing.T) {
79+
func TestParserKeepWhitespacesInAssigment(t *testing.T) {
8180
queryParser := NewQueryParser("a | b.c = 'hello world'")
8281
_, err := queryParser.Parse(1)
8382
if err != nil {
8483
t.Errorf("Expected nil, but got not nil: %s", err.Error())
8584
}
8685
}
8786

88-
func TestParserAssignment(t *testing.T) {
87+
func TestParserAssignment(t *testing.T) {
8988
queryParser := NewQueryParser("hello='world'")
9089
_, err := queryParser.Parse(1)
9190
if err != nil {
9291
t.Errorf("Expected nil, but got not nil: %s", err.Error())
9392
}
9493
}
9594

96-
func TestParserAssignment1(t *testing.T) {
95+
func TestParserAssignment1(t *testing.T) {
9796
queryParser := NewQueryParser("a & hello='big world'")
9897
_, err := queryParser.Parse(1)
9998
if err != nil {
@@ -149,7 +148,6 @@ func TestWrongComplexQuery2(t *testing.T) {
149148
}
150149
}
151150

152-
153151
func TestComplexQuery1(t *testing.T) {
154152
queryParser := NewQueryParserV2("(a & (string with spaces | c) | d)")
155153
_, err := queryParser.Parse(1)
@@ -311,5 +309,3 @@ func TestQueryImageWidth(t *testing.T) {
311309
ok(t, err)
312310
equals(t, strings.Contains(parseResult.Query, "image_width>50"), true)
313311
}
314-
315-

src/parser/v2/parser_test.go

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package imagemonkeyquerylang
22

33
import (
4-
"testing"
5-
"reflect"
6-
"runtime"
74
"fmt"
85
"path/filepath"
6+
"reflect"
7+
"runtime"
8+
"testing"
99
)
1010

1111
// ok fails the test if an err is not nil.
@@ -35,95 +35,94 @@ func equals(tb testing.TB, exp, act interface{}) {
3535
}
3636
}
3737

38-
39-
func TestParserCorrect(t *testing.T) {
38+
func TestParserCorrect(t *testing.T) {
4039
queryParser := NewQueryParser("a & b & c")
4140
parseResult, err := queryParser.Parse()
4241
if err != nil {
43-
t.Errorf(err.Error())
42+
t.Errorf("%s", err.Error())
4443
}
4544
equals(t, len(parseResult.QueryValues), 3)
4645
equals(t, parseResult.QueryValues, []interface{}{"a", "b", "c"})
4746
equals(t, parseResult.Query, "q.accessors @> ARRAY[$1]::text[] AND q.accessors @> ARRAY[$2]::text[] AND q.accessors @> ARRAY[$3]::text[]")
4847
}
4948

50-
func TestParserCorrectWithParentheses(t *testing.T) {
49+
func TestParserCorrectWithParentheses(t *testing.T) {
5150
queryParser := NewQueryParser("(a & b & c)")
5251
parseResult, err := queryParser.Parse()
5352
if err != nil {
54-
t.Errorf(err.Error())
53+
t.Errorf("%s", err.Error())
5554
}
5655
equals(t, len(parseResult.QueryValues), 3)
5756
equals(t, parseResult.QueryValues, []interface{}{"a", "b", "c"})
5857
equals(t, parseResult.Query, "(q.accessors @> ARRAY[$1]::text[] AND q.accessors @> ARRAY[$2]::text[] AND q.accessors @> ARRAY[$3]::text[])")
5958
}
6059

61-
func TestParserCorrectWithMultipleParentheses(t *testing.T) {
60+
func TestParserCorrectWithMultipleParentheses(t *testing.T) {
6261
queryParser := NewQueryParser("(a & (b | c))")
6362
parseResult, err := queryParser.Parse()
6463
if err != nil {
65-
t.Errorf(err.Error())
64+
t.Errorf("%s", err.Error())
6665
}
6766
equals(t, len(parseResult.QueryValues), 3)
6867
equals(t, parseResult.QueryValues, []interface{}{"a", "b", "c"})
6968
equals(t, parseResult.Query, "(q.accessors @> ARRAY[$1]::text[] AND (q.accessors @> ARRAY[$2]::text[] OR q.accessors @> ARRAY[$3]::text[]))")
7069
}
7170

72-
func TestParserCorrectWithMultipleParentheses2(t *testing.T) {
71+
func TestParserCorrectWithMultipleParentheses2(t *testing.T) {
7372
queryParser := NewQueryParser("(a | (b | c))")
7473
parseResult, err := queryParser.Parse()
7574
if err != nil {
76-
t.Errorf(err.Error())
75+
t.Errorf("%s", err.Error())
7776
}
7877
equals(t, len(parseResult.QueryValues), 3)
7978
equals(t, parseResult.QueryValues, []interface{}{"a", "b", "c"})
8079
equals(t, parseResult.Query, "(q.accessors @> ARRAY[$1]::text[] OR (q.accessors @> ARRAY[$2]::text[] OR q.accessors @> ARRAY[$3]::text[]))")
8180
}
8281

83-
func TestParserCorrectWithMultipleParentheses3(t *testing.T) {
82+
func TestParserCorrectWithMultipleParentheses3(t *testing.T) {
8483
queryParser := NewQueryParser("((a | (b | c)))")
8584
parseResult, err := queryParser.Parse()
8685
if err != nil {
87-
t.Errorf(err.Error())
86+
t.Errorf("%s", err.Error())
8887
}
8988
equals(t, len(parseResult.QueryValues), 3)
9089
equals(t, parseResult.QueryValues, []interface{}{"a", "b", "c"})
9190
equals(t, parseResult.Query, "((q.accessors @> ARRAY[$1]::text[] OR (q.accessors @> ARRAY[$2]::text[] OR q.accessors @> ARRAY[$3]::text[])))")
9291
}
9392

94-
func TestParserIncorrectSyntax(t *testing.T) {
93+
func TestParserIncorrectSyntax(t *testing.T) {
9594
queryParser := NewQueryParser("a & b & |")
9695
_, err := queryParser.Parse()
9796
if err == nil {
9897
t.Errorf("Expected not nil, but got nil")
9998
}
10099
}
101100

102-
func TestParserIncorrectSyntax2(t *testing.T) {
101+
func TestParserIncorrectSyntax2(t *testing.T) {
103102
queryParser := NewQueryParser("a |")
104103
_, err := queryParser.Parse()
105104
if err == nil {
106105
t.Errorf("Expected not nil, but got nil")
107106
}
108107
}
109108

110-
func TestParserIncorrectBrackets(t *testing.T) {
109+
func TestParserIncorrectBrackets(t *testing.T) {
111110
queryParser := NewQueryParser("a & b & )")
112111
_, err := queryParser.Parse()
113112
if err == nil {
114113
t.Errorf("Expected not nil, but got nil")
115114
}
116115
}
117116

118-
func TestParserIncorrectLength(t *testing.T) {
117+
func TestParserIncorrectLength(t *testing.T) {
119118
queryParser := NewQueryParser("a & b & c & d & e & f & f & g & h & z & u)")
120119
_, err := queryParser.Parse()
121120
if err == nil {
122121
t.Errorf("Expected not nil, but got nil")
123122
}
124123
}
125124

126-
func TestParserKeepWhitespacesInAssigment(t *testing.T) {
125+
func TestParserKeepWhitespacesInAssigment(t *testing.T) {
127126
queryParser := NewQueryParser("a | b.c = 'hello world'")
128127
parseResult, err := queryParser.Parse()
129128
if err != nil {
@@ -134,7 +133,7 @@ func TestParserKeepWhitespacesInAssigment(t *testing.T) {
134133
equals(t, parseResult.Query, "q.accessors @> ARRAY[$1]::text[] OR q.accessors @> ARRAY[$2]::text[]")
135134
}
136135

137-
func TestParserKeepWhitespacesInAssigmentWithMultipleSpacesBefore(t *testing.T) {
136+
func TestParserKeepWhitespacesInAssigmentWithMultipleSpacesBefore(t *testing.T) {
138137
queryParser := NewQueryParser("a | b.c = 'hello world'")
139138
parseResult, err := queryParser.Parse()
140139
if err != nil {
@@ -145,15 +144,15 @@ func TestParserKeepWhitespacesInAssigmentWithMultipleSpacesBefore(t *testing.T)
145144
equals(t, parseResult.Query, "q.accessors @> ARRAY[$1]::text[] OR q.accessors @> ARRAY[$2]::text[]")
146145
}
147146

148-
func TestParserAssignment(t *testing.T) {
147+
func TestParserAssignment(t *testing.T) {
149148
queryParser := NewQueryParser("hello='world'")
150149
_, err := queryParser.Parse()
151150
if err != nil {
152151
t.Errorf("Expected nil, but got not nil: %s", err.Error())
153152
}
154153
}
155154

156-
func TestParserAssignment1(t *testing.T) {
155+
func TestParserAssignment1(t *testing.T) {
157156
queryParser := NewQueryParser("a & hello='big world'")
158157
_, err := queryParser.Parse()
159158
if err != nil {

0 commit comments

Comments
 (0)