Skip to content

Commit 51b4c95

Browse files
fix: lint issues
1 parent 65c6108 commit 51b4c95

25 files changed

Lines changed: 327 additions & 300 deletions

.github/workflows/ci_server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
go-version-file: 'server/go.mod'
1616
cache: false
1717
- name: golangci-lint
18-
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
18+
uses: golangci/golangci-lint-action@v9
1919
with:
2020
version: v1.55
2121
args: --timeout=10m

go.work.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ github.com/alexflint/go-scalar v1.0.0 h1:NGupf1XV/Xb04wXskDFzS0KWOLH632W/EO4fAFi
259259
github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw=
260260
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
261261
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
262-
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
263-
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
264262
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
265263
github.com/apache/arrow/go/v12 v12.0.0 h1:xtZE63VWl7qLdB0JObIXvvhGjoVNrQ9ciIHG2OK5cmc=
266264
github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY=
@@ -307,6 +305,7 @@ github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1
307305
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
308306
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
309307
github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU=
308+
github.com/fasthttp/websocket v1.4.3-rc.6/go.mod h1:43W9OM2T8FeXpCWMsBd9Cb7nE2CACNqNvCqQCoty/Lc=
310309
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
311310
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
312311
github.com/garyburd/redigo v1.1.1-0.20170914051019-70e1b1943d4f h1:Sk0u0gIncQaQD23zAoAZs2DNi2u2l5UTLi4CmCBL5v8=
@@ -424,6 +423,7 @@ github.com/reearth/reearthx v0.0.0-20240229141256-04bd46953fe6/go.mod h1:8DSD6e+
424423
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 h1:jMxcLa+VjJKhpCwbLUXAD15wJ+hhvXMLujCl3MkXpfM=
425424
github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=
426425
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
426+
github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873/go.mod h1:dmPawKuiAeG/aFYVs2i+Dyosoo7FNcm+Pi8iK6ZUrX8=
427427
github.com/sosodev/duration v1.1.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg=
428428
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
429429
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
@@ -506,11 +506,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
506506
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
507507
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
508508
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
509+
golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ=
509510
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
510511
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
511512
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
512513
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
513514
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
515+
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
514516
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
515517
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
516518
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=

server/.golangci.yml.bak

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
run:
2+
timeout: 10m
3+
4+
linters:
5+
enable:
6+
- gofmt
7+
- goimports
8+
9+
issues:
10+
exclude-use-default: false
11+
12+
linters-settings:
13+
goimports:
14+
local-prefixes: github.com/reearth/reearth

server/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
lint:
2-
golangci-lint run --fix
2+
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:latest-alpine golangci-lint run --timeout=60m
33

44
test:
55
go test -race -short -v ./...

server/e2e/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func StartServerWithRepos(t *testing.T, cfg *config.Config, repos *repo.Containe
106106
}
107107
})
108108

109-
return httpexpect.New(t, "http://"+l.Addr().String())
109+
return httpexpect.Default(t, "http://"+l.Addr().String())
110110
}
111111

112112
type GraphQLRequest struct {
@@ -181,5 +181,5 @@ func StartGQLServerWithRepos(t *testing.T, ctx context.Context, cfg *config.Conf
181181
t.Fatalf("server serve: %v", err)
182182
}
183183
})
184-
return httpexpect.New(t, "http://"+l.Addr().String())
184+
return httpexpect.Default(t, "http://"+l.Addr().String())
185185
}

server/e2e/dataset_export_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ func TestDatasetExport(t *testing.T) {
3333
WithHeader("X-Reearth-Debug-User", uID.String()).
3434
Expect().
3535
Status(http.StatusOK).
36-
ContentType("text/csv")
37-
res.Header("Content-Disposition").Equal("attachment;filename=test.csv")
38-
res.Body().Equal(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
36+
HasContentType("text/csv")
37+
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv")
38+
res.Body().IsEqual(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
3939

4040
res = e.GET("/api/datasets/{}.csv", dssID).
4141
WithHeader("X-Reearth-Debug-User", uID.String()).
4242
Expect().
4343
Status(http.StatusOK).
44-
ContentType("text/csv")
45-
res.Header("Content-Disposition").Equal("attachment;filename=test.csv")
46-
res.Body().Equal(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
44+
HasContentType("text/csv")
45+
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv")
46+
res.Body().IsEqual(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
4747

4848
res = e.GET("/api/datasets/{}.json", dssID).
4949
WithHeader("X-Reearth-Debug-User", uID.String()).
5050
Expect().
5151
Status(http.StatusOK).
52-
ContentType("application/json")
53-
res.Header("Content-Disposition").Equal("attachment;filename=test.csv.json")
52+
HasContentType("application/json")
53+
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv.json")
5454

55-
res.JSON().Equal(map[string]any{
55+
res.JSON().IsEqual(map[string]any{
5656
"schema": map[string]any{
5757
"$schema": "http://json-schema.org/draft-07/schema#",
5858
"$id": "#/schemas/" + dssID.String(),

server/e2e/gql_asset_test.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ func TestGetAssetsKeyword(t *testing.T) {
151151
}
152152
res := GetAssets(e, uID.String(), variables)
153153
if i < 1 {
154-
res.Object().Value("edges").Array().Length().Equal(limit)
154+
res.Object().Value("edges").Array().Length().IsEqual(limit)
155155
} else {
156-
res.Object().Value("edges").Array().Length().Equal(9)
156+
res.Object().Value("edges").Array().Length().IsEqual(9)
157157
}
158-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
159-
res.Object().ValueEqual("totalCount", 19)
158+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
159+
res.Object().HasValue("totalCount", 19)
160160
if i < 1 {
161-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
161+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
162162
} else {
163-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
163+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
164164
}
165165
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
166166
}
@@ -181,16 +181,16 @@ func TestGetAssetsKeyword(t *testing.T) {
181181

182182
res := GetAssets(e, uID.String(), variables)
183183
if i < 1 {
184-
res.Object().Value("edges").Array().Length().Equal(limit)
184+
res.Object().Value("edges").Array().Length().IsEqual(limit)
185185
} else {
186-
res.Object().Value("edges").Array().Length().Equal(9)
186+
res.Object().Value("edges").Array().Length().IsEqual(9)
187187
}
188-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
189-
res.Object().ValueEqual("totalCount", 19)
188+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
189+
res.Object().HasValue("totalCount", 19)
190190
if i < 1 {
191-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
191+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
192192
} else {
193-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
193+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
194194
}
195195
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
196196
}
@@ -219,16 +219,16 @@ func TestGetAssetsLmit30(t *testing.T) {
219219
}
220220
res := GetAssets(e, uID.String(), variables)
221221
if i < 3 {
222-
res.Object().Value("edges").Array().Length().Equal(limit)
222+
res.Object().Value("edges").Array().Length().IsEqual(limit)
223223
} else {
224-
res.Object().Value("edges").Array().Length().Equal(10)
224+
res.Object().Value("edges").Array().Length().IsEqual(10)
225225
}
226-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
227-
res.Object().ValueEqual("totalCount", testDataCount)
226+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
227+
res.Object().HasValue("totalCount", testDataCount)
228228
if i < 3 {
229-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
229+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
230230
} else {
231-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
231+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
232232
}
233233
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
234234
}
@@ -247,16 +247,16 @@ func TestGetAssetsLmit30(t *testing.T) {
247247

248248
res := GetAssets(e, uID.String(), variables)
249249
if i < 3 {
250-
res.Object().Value("edges").Array().Length().Equal(limit)
250+
res.Object().Value("edges").Array().Length().IsEqual(limit)
251251
} else {
252-
res.Object().Value("edges").Array().Length().Equal(10)
252+
res.Object().Value("edges").Array().Length().IsEqual(10)
253253
}
254-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
255-
res.Object().ValueEqual("totalCount", testDataCount)
254+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
255+
res.Object().HasValue("totalCount", testDataCount)
256256
if i < 3 {
257-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
257+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
258258
} else {
259-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
259+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
260260
}
261261
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
262262
}
@@ -269,13 +269,13 @@ func checkGetAssetsASC(e *httpexpect.Expect, variables map[string]any, limit int
269269
variables["pagination"].(map[string]any)["before"] = endCursor // set cursor
270270
}
271271
res := GetAssets(e, uID.String(), variables)
272-
res.Object().Value("edges").Array().Length().Equal(limit)
273-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
274-
res.Object().ValueEqual("totalCount", testDataCount)
272+
res.Object().Value("edges").Array().Length().IsEqual(limit)
273+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
274+
res.Object().HasValue("totalCount", testDataCount)
275275
if i < testDataCount/limit-1 { // last
276-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
276+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
277277
} else {
278-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
278+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
279279
}
280280
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
281281
}
@@ -289,13 +289,13 @@ func checkGetAssetsDESC(e *httpexpect.Expect, variables map[string]any, limit in
289289
}
290290

291291
res := GetAssets(e, uID.String(), variables)
292-
res.Object().Value("edges").Array().Length().Equal(limit)
293-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
294-
res.Object().ValueEqual("totalCount", testDataCount)
292+
res.Object().Value("edges").Array().Length().IsEqual(limit)
293+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
294+
res.Object().HasValue("totalCount", testDataCount)
295295
if i < testDataCount/limit-1 { // last
296-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
296+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
297297
} else {
298-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
298+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
299299
}
300300
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
301301
}

server/e2e/gql_dataset_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ func checkGetDatasetsASC(e *httpexpect.Expect, variables map[string]any, limit i
7474
}
7575
res := GetDatasets(e, uID.String(), variables)
7676
// ValueDump(res)
77-
res.Object().Value("edges").Array().Length().Equal(limit)
78-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
79-
res.Object().ValueEqual("totalCount", testDataCount)
77+
res.Object().Value("edges").Array().Length().IsEqual(limit)
78+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
79+
res.Object().HasValue("totalCount", testDataCount)
8080
if i < testDataCount/limit-1 { // last
81-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
81+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
8282
} else {
83-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
83+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
8484
}
8585
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
8686
}
@@ -94,13 +94,13 @@ func checkGetDatasetsDESC(e *httpexpect.Expect, variables map[string]any, limit
9494
}
9595

9696
res := GetDatasets(e, uID.String(), variables)
97-
res.Object().Value("edges").Array().Length().Equal(limit)
98-
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
99-
res.Object().ValueEqual("totalCount", testDataCount)
97+
res.Object().Value("edges").Array().Length().IsEqual(limit)
98+
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
99+
res.Object().HasValue("totalCount", testDataCount)
100100
if i < testDataCount/limit-1 { // last
101-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
101+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
102102
} else {
103-
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
103+
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
104104
}
105105
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
106106
}

0 commit comments

Comments
 (0)