Skip to content

Commit 9d57704

Browse files
authored
Merge pull request #65 from lungria/feature/fix-last-import-time
fix last import time + some linter issues
2 parents fff3436 + 3d6cae0 commit 9d57704

File tree

13 files changed

+135
-113
lines changed

13 files changed

+135
-113
lines changed

.github/workflows/pr.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
- 5432:5432
2525
steps:
2626
- name: Set up Go 1.x
27-
uses: actions/setup-go@v2
27+
uses: actions/setup-go@v3
2828
with:
29-
go-version: ^1.17
29+
go-version: ^1.18
3030
id: go
3131

3232
- name: Check out code into the Go module directory
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
3434

3535
- name: Build
3636
run: go build -v .
@@ -46,8 +46,8 @@ jobs:
4646
name: Lint
4747
runs-on: ubuntu-20.04
4848
steps:
49-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v3
5050
- name: golangci-lint
51-
uses: golangci/golangci-lint-action@v2
51+
uses: golangci/golangci-lint-action@v3
5252
with:
53-
version: v1.42.1
53+
version: v1.46

.github/workflows/tag.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Set up Docker Buildx
1919
id: buildx
20-
uses: docker/setup-buildx-action@v1
20+
uses: docker/setup-buildx-action@v2
2121
with:
2222
version: latest
2323

2424
- name: Login to DockerHub
25-
uses: docker/login-action@v1
25+
uses: docker/login-action@v2
2626
with:
2727
username: ${{ secrets.DOCKER_USERNAME }}
2828
password: ${{ secrets.DOCKER_TOKEN }}
@@ -31,7 +31,7 @@ jobs:
3131
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
3232

3333
- name: Build and push
34-
uses: docker/build-push-action@v2
34+
uses: docker/build-push-action@v3
3535
with:
3636
platforms: linux/arm64,linux/amd64
3737
push: true

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.17.1-alpine3.14 as builder
1+
FROM golang:1.18.1-alpine3.14 as builder
22

33
ARG TARGETOS
44
ARG TARGETARCH

budget/budget_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ func TestBudgetsStorageGetLast_WhenNoLimitsExist_NoErrorReturned(t *testing.T) {
1919
budgetID := prepareTestBudget(t, pool)
2020
db := budget.NewRepository(pool)
2121

22-
budget, err := db.GetLast(context.Background())
22+
result, err := db.GetLast(context.Background())
2323

2424
assert.NoError(t, err)
25-
assert.Equal(t, budget.ID, budgetID)
25+
assert.Equal(t, result.ID, budgetID)
2626
}
2727

2828
func TestBudgetsStorageGetLast_WhenLimitsExist_NoErrorReturned(t *testing.T) {
@@ -51,12 +51,12 @@ func TestBudgetsStorageGetLast_WhenLimitsExist_NoErrorReturned(t *testing.T) {
5151

5252
db := budget.NewRepository(pool)
5353

54-
budget, err := db.GetLast(context.Background())
54+
result, err := db.GetLast(context.Background())
5555

5656
assert.NoError(t, err)
57-
assert.Equal(t, budget.ID, budgetID)
58-
assert.Len(t, budget.Limits, 2)
59-
assert.Equal(t, int64(200), budget.Limits[0].Amount)
57+
assert.Equal(t, result.ID, budgetID)
58+
assert.Len(t, result.Limits, 2)
59+
assert.Equal(t, int64(200), result.Limits[0].Amount)
6060
}
6161

6262
func prepareTestBudget(t *testing.T, db *pgxpool.Pool) int {
@@ -81,10 +81,10 @@ func prepareTestLimit(t *testing.T, db *pgxpool.Pool, budgetID int, limit budget
8181
require.NoError(t, err)
8282
}
8383

84-
func prepareTestCategory(t *testing.T, db *pgxpool.Pool, category category.Category) {
84+
func prepareTestCategory(t *testing.T, db *pgxpool.Pool, ctg category.Category) {
8585
_, err := db.Exec(context.Background(), `
8686
insert into category ("ID", "name", "logo", "createdAt")
87-
values ($1, $2, $3, current_timestamp(0))`, category.ID, category.Name, category.Logo)
87+
values ($1, $2, $3, current_timestamp(0))`, ctg.ID, ctg.Name, ctg.Logo)
8888

8989
require.NoError(t, err)
9090
}

go.mod

+23-21
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module github.com/lungria/spendshelf-backend
22

3-
go 1.17
3+
go 1.18
44

55
require (
6-
github.com/caarlos0/env/v6 v6.7.1
7-
github.com/gin-gonic/gin v1.7.4
8-
github.com/jackc/pgx/v4 v4.13.0
9-
github.com/rs/cors v1.8.0
10-
github.com/rs/zerolog v1.25.0
6+
github.com/caarlos0/env/v6 v6.9.1
7+
github.com/gin-gonic/gin v1.7.7
8+
github.com/jackc/pgx/v4 v4.16.1
9+
github.com/rs/cors/wrapper/gin v0.0.0-20220223021805-a4a5ce87d5a2
10+
github.com/rs/zerolog v1.26.1
1111
github.com/stretchr/testify v1.7.0
1212
)
1313

@@ -16,26 +16,28 @@ require (
1616
github.com/gin-contrib/sse v0.1.0 // indirect
1717
github.com/go-playground/locales v0.14.0 // indirect
1818
github.com/go-playground/universal-translator v0.18.0 // indirect
19-
github.com/go-playground/validator/v10 v10.4.1 // indirect
20-
github.com/golang/protobuf v1.3.3 // indirect
19+
github.com/go-playground/validator/v10 v10.11.0 // indirect
20+
github.com/golang/protobuf v1.5.2 // indirect
2121
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
22-
github.com/jackc/pgconn v1.10.0 // indirect
22+
github.com/jackc/pgconn v1.12.1 // indirect
2323
github.com/jackc/pgio v1.0.0 // indirect
2424
github.com/jackc/pgpassfile v1.0.0 // indirect
25-
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
25+
github.com/jackc/pgproto3/v2 v2.3.0 // indirect
2626
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
27-
github.com/jackc/pgtype v1.8.1 // indirect
28-
github.com/jackc/puddle v1.1.3 // indirect
29-
github.com/json-iterator/go v1.1.9 // indirect
30-
github.com/leodido/go-urn v1.2.0 // indirect
31-
github.com/mattn/go-isatty v0.0.12 // indirect
32-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
27+
github.com/jackc/pgtype v1.11.0 // indirect
28+
github.com/jackc/puddle v1.2.1 // indirect
29+
github.com/json-iterator/go v1.1.12 // indirect
30+
github.com/leodido/go-urn v1.2.1 // indirect
31+
github.com/mattn/go-isatty v0.0.14 // indirect
32+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3333
github.com/modern-go/reflect2 v1.0.2 // indirect
3434
github.com/pmezard/go-difflib v1.0.0 // indirect
35-
github.com/ugorji/go/codec v1.1.7 // indirect
36-
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
37-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
38-
golang.org/x/text v0.3.6 // indirect
39-
gopkg.in/yaml.v2 v2.2.8 // indirect
35+
github.com/rs/cors v1.8.2 // indirect
36+
github.com/ugorji/go/codec v1.2.7 // indirect
37+
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 // indirect
38+
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
39+
golang.org/x/text v0.3.7 // indirect
40+
google.golang.org/protobuf v1.28.0 // indirect
41+
gopkg.in/yaml.v2 v2.4.0 // indirect
4042
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
4143
)

0 commit comments

Comments
 (0)