Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump up go version to 1.21 #41

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.3'
go-version: '1.21'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: '1.21'
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
skip-go-installation: true
version: v1.50.1
version: v1.54
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.3'
go-version: '1.21'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: '1.21'
- name: install dependencies
run: go mod tidy
- name: test binaries
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: '1.21'
- name: install dependencies
run: go mod tidy
- name: install spicedb binary
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-alpine3.15 as builder
FROM golang:1.21-alpine3.19 as builder

RUN apk add make

Expand All @@ -11,7 +11,7 @@ COPY . .

RUN make build

FROM alpine:3.16
FROM alpine:3.19
COPY --from=builder /go/src/app/shield /usr/bin/
RUN apk update
RUN apk add ca-certificates
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $ docker run -p 8080:8080 \

Shield requires the following dependencies:

- Golang (version 1.18 or above)
- Golang (version 1.21 or above)
- Git

### Build
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/goto/shield

go 1.18
go 1.21

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2
Expand Down
36 changes: 18 additions & 18 deletions internal/api/v1beta1/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestCreateAction(t *testing.T) {
{
title: "should return internal error if action service return some error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
ID: testActionMap[testActionID].ID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
Expand All @@ -164,7 +164,7 @@ func TestCreateAction(t *testing.T) {
{
title: "should return bad request error if namespace id is wrong",
setup: func(as *mocks.ActionService) {
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
ID: testActionMap[testActionID].ID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
Expand All @@ -182,7 +182,7 @@ func TestCreateAction(t *testing.T) {
{
title: "should return bad request error if if id is empty",
setup: func(as *mocks.ActionService) {
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
}).Return(action.Action{}, action.ErrInvalidID)
Expand All @@ -198,7 +198,7 @@ func TestCreateAction(t *testing.T) {
{
title: "should return bad request error if if name is empty",
setup: func(as *mocks.ActionService) {
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
ID: testActionMap[testActionID].ID,
NamespaceID: testActionMap[testActionID].NamespaceID,
}).Return(action.Action{}, action.ErrInvalidDetail)
Expand All @@ -214,7 +214,7 @@ func TestCreateAction(t *testing.T) {
{
title: "should return success if action service return nil error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Create(mock.AnythingOfType("*context.emptyCtx"), action.Action{
as.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), action.Action{
ID: testActionMap[testActionID].ID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestCreateAction(t *testing.T) {
tt.setup(mockActionSrv)
}
mockDep := Handler{actionService: mockActionSrv}
resp, err := mockDep.CreateAction(context.Background(), tt.req)
resp, err := mockDep.CreateAction(context.TODO(), tt.req)
assert.EqualValues(t, tt.want, resp)
assert.EqualValues(t, tt.err, err)
})
Expand All @@ -264,7 +264,7 @@ func TestHandler_GetAction(t *testing.T) {
{
name: "should return internal error if action service return some error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(action.Action{}, errors.New("some error"))
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(action.Action{}, errors.New("some error"))
},
request: &shieldv1beta1.GetActionRequest{
Id: testActionID,
Expand All @@ -275,7 +275,7 @@ func TestHandler_GetAction(t *testing.T) {
{
name: "should return not found error if action id not exist",
setup: func(as *mocks.ActionService) {
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(action.Action{}, action.ErrNotExist)
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(action.Action{}, action.ErrNotExist)
},
request: &shieldv1beta1.GetActionRequest{
Id: testActionID,
Expand All @@ -286,7 +286,7 @@ func TestHandler_GetAction(t *testing.T) {
{
name: "should return not found error if action id is empty",
setup: func(as *mocks.ActionService) {
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), "").Return(action.Action{}, action.ErrInvalidID)
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), "").Return(action.Action{}, action.ErrInvalidID)
},
request: &shieldv1beta1.GetActionRequest{},
want: nil,
Expand All @@ -295,7 +295,7 @@ func TestHandler_GetAction(t *testing.T) {
{
name: "should return success if action service return nil error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), testActionID).Return(testActionMap[testActionID], nil)
as.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), testActionID).Return(testActionMap[testActionID], nil)
},
request: &shieldv1beta1.GetActionRequest{
Id: testActionID,
Expand All @@ -318,7 +318,7 @@ func TestHandler_GetAction(t *testing.T) {
tt.setup(mockActionSrv)
}
mockDep := Handler{actionService: mockActionSrv}
resp, err := mockDep.GetAction(context.Background(), tt.request)
resp, err := mockDep.GetAction(context.TODO(), tt.request)
assert.EqualValues(t, tt.want, resp)
assert.EqualValues(t, tt.wantErr, err)
})
Expand All @@ -336,7 +336,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return internal error if action service return some error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionID, action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionID, action.Action{
ID: testActionID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
Expand All @@ -355,7 +355,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return not found error if action id not exist",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionID, action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionID, action.Action{
ID: testActionID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrNotExist)
Expand All @@ -374,7 +374,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return not found error if action id is empty",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), "", action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), "", action.Action{
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrInvalidID)
},
Expand All @@ -391,7 +391,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return bad request error if namespace id not exist",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
ID: testActionID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, namespace.ErrNotExist)
Expand All @@ -410,7 +410,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return bad request error if name is empty",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
ID: testActionID,
NamespaceID: testActionMap[testActionID].NamespaceID}).Return(action.Action{}, action.ErrInvalidDetail)
},
Expand All @@ -427,7 +427,7 @@ func TestHandler_UpdateAction(t *testing.T) {
{
name: "should return success if action service return nil error",
setup: func(as *mocks.ActionService) {
as.EXPECT().Update(mock.AnythingOfType("*context.emptyCtx"), testActionMap[testActionID].ID, action.Action{
as.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), testActionMap[testActionID].ID, action.Action{
ID: testActionID,
Name: testActionMap[testActionID].Name,
NamespaceID: testActionMap[testActionID].NamespaceID,
Expand Down Expand Up @@ -459,7 +459,7 @@ func TestHandler_UpdateAction(t *testing.T) {
tt.setup(mockActionSrv)
}
mockDep := Handler{actionService: mockActionSrv}
resp, err := mockDep.UpdateAction(context.Background(), tt.request)
resp, err := mockDep.UpdateAction(context.TODO(), tt.request)
assert.EqualValues(t, tt.want, resp)
assert.EqualValues(t, tt.wantErr, err)
})
Expand Down
Loading
Loading