Skip to content

Commit 192820a

Browse files
authored
chore: bump up go version to 1.21 (#41)
1 parent 299b82d commit 192820a

File tree

18 files changed

+255
-255
lines changed

18 files changed

+255
-255
lines changed

.github/workflows/build_dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Go
1414
uses: actions/setup-go@v2
1515
with:
16-
go-version: '1.18.3'
16+
go-version: '1.21'
1717
- name: Login to DockerHub
1818
uses: docker/login-action@v1
1919
with:

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
steps:
1414
- uses: actions/setup-go@v2
1515
with:
16-
go-version: '1.18'
16+
go-version: '1.21'
1717
- uses: actions/checkout@v2
1818
with:
1919
fetch-depth: 0
2020
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v3
21+
uses: golangci/golangci-lint-action@v4
2222
with:
2323
skip-go-installation: true
24-
version: v1.50.1
24+
version: v1.54

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v2
1919
with:
20-
go-version: '1.18.3'
20+
go-version: '1.21'
2121
- name: Login to DockerHub
2222
uses: docker/login-action@v1
2323
with:

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set up Go
3030
uses: actions/setup-go@v2
3131
with:
32-
go-version: '1.18'
32+
go-version: '1.21'
3333
- name: install dependencies
3434
run: go mod tidy
3535
- name: test binaries
@@ -74,7 +74,7 @@ jobs:
7474
- name: Set up Go
7575
uses: actions/setup-go@v2
7676
with:
77-
go-version: '1.18'
77+
go-version: '1.21'
7878
- name: install dependencies
7979
run: go mod tidy
8080
- name: install spicedb binary

Dockerfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.18-alpine3.15 as builder
1+
FROM golang:1.21-alpine3.19 as builder
22

33
RUN apk add make
44

@@ -11,7 +11,7 @@ COPY . .
1111

1212
RUN make build
1313

14-
FROM alpine:3.16
14+
FROM alpine:3.19
1515
COPY --from=builder /go/src/app/shield /usr/bin/
1616
RUN apk update
1717
RUN apk add ca-certificates

docs/docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $ docker run -p 8080:8080 \
5151

5252
Shield requires the following dependencies:
5353

54-
- Golang (version 1.18 or above)
54+
- Golang (version 1.21 or above)
5555
- Git
5656

5757
### Build

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/goto/shield
22

3-
go 1.18
3+
go 1.21
44

55
require (
66
contrib.go.opencensus.io/exporter/prometheus v0.4.2

internal/api/v1beta1/action_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func TestCreateAction(t *testing.T) {
146146
{
147147
title: "should return internal error if action service return some error",
148148
setup: func(as *mocks.ActionService) {
149-
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
149+
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
150150
ID: testActionMap[testActionID].ID,
151151
Name: testActionMap[testActionID].Name,
152152
NamespaceID: testActionMap[testActionID].NamespaceID,
@@ -164,7 +164,7 @@ func TestCreateAction(t *testing.T) {
164164
{
165165
title: "should return bad request error if namespace id is wrong",
166166
setup: func(as *mocks.ActionService) {
167-
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
167+
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
168168
ID: testActionMap[testActionID].ID,
169169
Name: testActionMap[testActionID].Name,
170170
NamespaceID: testActionMap[testActionID].NamespaceID,
@@ -182,7 +182,7 @@ func TestCreateAction(t *testing.T) {
182182
{
183183
title: "should return bad request error if if id is empty",
184184
setup: func(as *mocks.ActionService) {
185-
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
185+
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
186186
Name: testActionMap[testActionID].Name,
187187
NamespaceID: testActionMap[testActionID].NamespaceID,
188188
}).Return(action.Action{}, action.ErrInvalidID)
@@ -198,7 +198,7 @@ func TestCreateAction(t *testing.T) {
198198
{
199199
title: "should return bad request error if if name is empty",
200200
setup: func(as *mocks.ActionService) {
201-
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
201+
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
202202
ID: testActionMap[testActionID].ID,
203203
NamespaceID: testActionMap[testActionID].NamespaceID,
204204
}).Return(action.Action{}, action.ErrInvalidDetail)
@@ -214,7 +214,7 @@ func TestCreateAction(t *testing.T) {
214214
{
215215
title: "should return success if action service return nil error",
216216
setup: func(as *mocks.ActionService) {
217-
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
217+
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
218218
ID: testActionMap[testActionID].ID,
219219
Name: testActionMap[testActionID].Name,
220220
NamespaceID: testActionMap[testActionID].NamespaceID,
@@ -246,7 +246,7 @@ func TestCreateAction(t *testing.T) {
246246
tt.setup(mockActionSrv)
247247
}
248248
mockDep := Handler{actionService: mockActionSrv}
249-
resp, err := mockDep.CreateAction(context.Background(), tt.req)
249+
resp, err := mockDep.CreateAction(context.TODO(), tt.req)
250250
assert.EqualValues(t, tt.want, resp)
251251
assert.EqualValues(t, tt.err, err)
252252
})
@@ -264,7 +264,7 @@ func TestHandler_GetAction(t *testing.T) {
264264
{
265265
name: "should return internal error if action service return some error",
266266
setup: func(as *mocks.ActionService) {
267-
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(action.Action{}, errors.New("some error"))
267+
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(action.Action{}, errors.New("some error"))
268268
},
269269
request: &shieldv1beta1.GetActionRequest{
270270
Id: testActionID,
@@ -275,7 +275,7 @@ func TestHandler_GetAction(t *testing.T) {
275275
{
276276
name: "should return not found error if action id not exist",
277277
setup: func(as *mocks.ActionService) {
278-
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(action.Action{}, action.ErrNotExist)
278+
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(action.Action{}, action.ErrNotExist)
279279
},
280280
request: &shieldv1beta1.GetActionRequest{
281281
Id: testActionID,
@@ -286,7 +286,7 @@ func TestHandler_GetAction(t *testing.T) {
286286
{
287287
name: "should return not found error if action id is empty",
288288
setup: func(as *mocks.ActionService) {
289-
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), "").Return(action.Action{}, action.ErrInvalidID)
289+
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), "").Return(action.Action{}, action.ErrInvalidID)
290290
},
291291
request: &shieldv1beta1.GetActionRequest{},
292292
want: nil,
@@ -295,7 +295,7 @@ func TestHandler_GetAction(t *testing.T) {
295295
{
296296
name: "should return success if action service return nil error",
297297
setup: func(as *mocks.ActionService) {
298-
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(testActionMap[testActionID], nil)
298+
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(testActionMap[testActionID], nil)
299299
},
300300
request: &shieldv1beta1.GetActionRequest{
301301
Id: testActionID,
@@ -318,7 +318,7 @@ func TestHandler_GetAction(t *testing.T) {
318318
tt.setup(mockActionSrv)
319319
}
320320
mockDep := Handler{actionService: mockActionSrv}
321-
resp, err := mockDep.GetAction(context.Background(), tt.request)
321+
resp, err := mockDep.GetAction(context.TODO(), tt.request)
322322
assert.EqualValues(t, tt.want, resp)
323323
assert.EqualValues(t, tt.wantErr, err)
324324
})
@@ -336,7 +336,7 @@ func TestHandler_UpdateAction(t *testing.T) {
336336
{
337337
name: "should return internal error if action service return some error",
338338
setup: func(as *mocks.ActionService) {
339-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionID, action.Action{
339+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionID, action.Action{
340340
ID: testActionID,
341341
Name: testActionMap[testActionID].Name,
342342
NamespaceID: testActionMap[testActionID].NamespaceID,
@@ -355,7 +355,7 @@ func TestHandler_UpdateAction(t *testing.T) {
355355
{
356356
name: "should return not found error if action id not exist",
357357
setup: func(as *mocks.ActionService) {
358-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionID, action.Action{
358+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionID, action.Action{
359359
ID: testActionID,
360360
Name: testActionMap[testActionID].Name,
361361
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrNotExist)
@@ -374,7 +374,7 @@ func TestHandler_UpdateAction(t *testing.T) {
374374
{
375375
name: "should return not found error if action id is empty",
376376
setup: func(as *mocks.ActionService) {
377-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), "", action.Action{
377+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), "", action.Action{
378378
Name: testActionMap[testActionID].Name,
379379
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrInvalidID)
380380
},
@@ -391,7 +391,7 @@ func TestHandler_UpdateAction(t *testing.T) {
391391
{
392392
name: "should return bad request error if namespace id not exist",
393393
setup: func(as *mocks.ActionService) {
394-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
394+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
395395
ID: testActionID,
396396
Name: testActionMap[testActionID].Name,
397397
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, namespace.ErrNotExist)
@@ -410,7 +410,7 @@ func TestHandler_UpdateAction(t *testing.T) {
410410
{
411411
name: "should return bad request error if name is empty",
412412
setup: func(as *mocks.ActionService) {
413-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
413+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
414414
ID: testActionID,
415415
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrInvalidDetail)
416416
},
@@ -427,7 +427,7 @@ func TestHandler_UpdateAction(t *testing.T) {
427427
{
428428
name: "should return success if action service return nil error",
429429
setup: func(as *mocks.ActionService) {
430-
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
430+
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
431431
ID: testActionID,
432432
Name: testActionMap[testActionID].Name,
433433
NamespaceID: testActionMap[testActionID].NamespaceID,
@@ -459,7 +459,7 @@ func TestHandler_UpdateAction(t *testing.T) {
459459
tt.setup(mockActionSrv)
460460
}
461461
mockDep := Handler{actionService: mockActionSrv}
462-
resp, err := mockDep.UpdateAction(context.Background(), tt.request)
462+
resp, err := mockDep.UpdateAction(context.TODO(), tt.request)
463463
assert.EqualValues(t, tt.want, resp)
464464
assert.EqualValues(t, tt.wantErr, err)
465465
})

0 commit comments

Comments
 (0)