Skip to content

Commit 00753eb

Browse files
authored
Merge pull request #8 from aserto-dev/upd-deps
upd deps
2 parents 15487bd + ed982e8 commit 00753eb

11 files changed

Lines changed: 129 additions & 1712 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,38 @@ on:
1515
- release-*
1616
env:
1717
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'development' || '' }}
18-
GO_VERSION: "1.17"
18+
GO_VERSION: "1.22"
19+
GO_LANGCI_LINT_VERSION: "v1.56.2"
20+
GO_TESTSUM_VERSION: "1.11.0"
1921

2022
jobs:
2123
test:
2224
runs-on: ubuntu-latest
2325
steps:
24-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2527
with:
2628
fetch-depth: 0
2729
- name: Setup Go
28-
uses: actions/setup-go@v2
30+
uses: actions/setup-go@v5
2931
with:
3032
go-version: ${{ env.GO_VERSION }}
31-
- name: Setup caching
32-
uses: actions/cache@v1
33+
-
34+
name: Lint
35+
uses: golangci/golangci-lint-action@v4
3336
with:
34-
path: ~/go/pkg/mod
35-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
36-
restore-keys: |
37-
${{ runner.os }}-go-
38-
- name: Install Tools
39-
run: |
40-
go run mage.go deps
41-
- name: Lint
42-
run: |
43-
go run mage.go lint
44-
- name: Test
37+
version: ${{ env.GO_LANGCI_LINT_VERSION }}
38+
args: --timeout=30m
39+
-
40+
name: Test Setup
41+
uses: autero1/action-gotestsum@v2.0.0
42+
with:
43+
gotestsum_version: ${{ env.GO_TESTSUM_VERSION }}
44+
-
45+
name: Test
4546
run: |
46-
go run mage.go test
47-
- name: Upload code coverage
47+
gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./... ./...
48+
-
49+
name: Upload code coverage
4850
uses: shogo82148/actions-goveralls@v1
4951
continue-on-error: true
5052
with:

.github/workflows/gitleaks-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
test:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 0
1212
- name: gitleaks-check

.golangci.yaml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ linters-settings:
1414
threshold: 100
1515
funlen:
1616
lines: 100
17-
statements: 50
17+
statements: 80
1818
gci:
1919
local-prefixes: github.com/golangci/golangci-lint
2020
goconst:
@@ -31,6 +31,7 @@ linters-settings:
3131
- dupImport # https://github.com/go-critic/go-critic/issues/845
3232
- ifElseChain
3333
- octalLiteral
34+
- whyNoLint
3435
- wrapperFunc
3536
gocyclo:
3637
min-complexity: 20
@@ -42,7 +43,11 @@ linters-settings:
4243
settings:
4344
mnd:
4445
# don't include the "operation" and "assign"
45-
checks: argument,case,condition,return
46+
checks:
47+
- argument
48+
- case
49+
- condition
50+
- return
4651
govet:
4752
check-shadowing: true
4853
settings:
@@ -57,7 +62,6 @@ linters-settings:
5762
misspell:
5863
locale: US
5964
nolintlint:
60-
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
6165
allow-unused: false # report any unused nolint directives
6266
require-explanation: false # don't require an explanation for nolint directives
6367
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
@@ -67,33 +71,52 @@ linters:
6771
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
6872
disable-all: true
6973
enable:
74+
- asciicheck
7075
- bodyclose
71-
- deadcode
72-
- depguard
76+
- dogsled
7377
- errcheck
7478
- exportloopref
79+
- exhaustive
7580
- funlen
7681
- gochecknoinits
7782
- goconst
7883
- gocritic
7984
- gocyclo
85+
- godot
86+
# - goerr113 # temporary disabled
8087
- gofmt
8188
- goimports
89+
- goprintffuncname
8290
- gosec
8391
- gosimple
8492
- govet
8593
- ineffassign
8694
- misspell
8795
- nakedret
88-
- revive
96+
- noctx
97+
# - rowserrcheck # disable https://github.com/golangci/golangci-lint/issues/2649.
8998
- staticcheck
90-
- structcheck
9199
- stylecheck
100+
- testpackage
92101
- typecheck
93102
- unconvert
94103
- unparam
95104
- unused
96-
- varcheck
105+
106+
# don't enable:
107+
# - depguard
108+
# - dupl
109+
# - gochecknoglobals
110+
# - gocognit
111+
# - godox
112+
# - gomnd
113+
# - lll
114+
# - nestif
115+
# - nolintlint # conflict with 1.19 gofmt changes
116+
# - prealloc
117+
# - revive
118+
# - wsl
119+
# - whitespace
97120

98121
issues:
99122
# List of regexps of issue texts to exclude, empty list by default.
@@ -114,7 +137,24 @@ issues:
114137
- gocritic
115138
- text: "unnamedResult:"
116139
linters:
117-
- gocritic
140+
- gocritic
141+
- path: \.resolvers\.go
142+
text: "typeDefFirst:"
143+
linters:
144+
- gocritic
145+
- path: \.resolvers\.go
146+
text: "paramTypeCombine:"
147+
linters:
148+
- gocritic
149+
- path: \.resolvers\.go
150+
text: "hugeParam:"
151+
linters:
152+
- gocritic
153+
- text: "G404"
154+
linters:
155+
- gosec
118156

119157
run:
120-
timeout: 5m
158+
timeout: 5m
159+
skip-dirs:
160+
- aserto/directory

Depfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

errors.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
const (
1919
MessageKey = "msg"
20+
colon = ": "
2021
)
2122

2223
var (
@@ -81,14 +82,14 @@ func (e *AsertoError) Error() string {
8182
innerMessage = e.errs[0].Error()
8283

8384
for _, err := range e.errs[1:] {
84-
innerMessage = innerMessage + ": " + err.Error()
85+
innerMessage = innerMessage + colon + err.Error()
8586
}
8687
}
8788
if len(e.data) > 0 {
8889
for k, v := range e.data {
8990
if k == "msg" {
9091
if innerMessage != "" {
91-
innerMessage += ": "
92+
innerMessage += colon
9293
}
9394
innerMessage += v
9495
}
@@ -135,7 +136,7 @@ func (e *AsertoError) Msg(message string) *AsertoError {
135136

136137
if message != "" {
137138
if existingMsg, ok := c.data[MessageKey]; ok {
138-
c.data[MessageKey] = existingMsg + ": " + message
139+
c.data[MessageKey] = existingMsg + colon + message
139140
} else {
140141
c.data[MessageKey] = message
141142
}
@@ -150,7 +151,7 @@ func (e *AsertoError) Msgf(message string, args ...interface{}) *AsertoError {
150151
message = fmt.Sprintf(message, args...)
151152

152153
if existingMsg, ok := c.data[MessageKey]; ok {
153-
c.data[MessageKey] = existingMsg + ": " + message
154+
c.data[MessageKey] = existingMsg + colon + message
154155
} else {
155156
c.data[MessageKey] = message
156157
}

go.mod

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
module github.com/aserto-dev/errors
22

3-
go 1.17
3+
go 1.19
44

55
require (
6-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0
7-
github.com/magefile/mage v1.14.0
6+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
87
github.com/pkg/errors v0.9.1
9-
github.com/rs/zerolog v1.28.0
10-
github.com/stretchr/testify v1.8.0
11-
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1
12-
google.golang.org/grpc v1.50.1
8+
github.com/rs/zerolog v1.32.0
9+
github.com/stretchr/testify v1.9.0
10+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7
11+
google.golang.org/grpc v1.62.1
1312
)
1413

1514
require (
1615
github.com/davecgh/go-spew v1.1.1 // indirect
17-
github.com/golang/protobuf v1.5.2 // indirect
16+
github.com/golang/protobuf v1.5.4 // indirect
1817
github.com/kr/text v0.2.0 // indirect
19-
github.com/mattn/go-colorable v0.1.12 // indirect
20-
github.com/mattn/go-isatty v0.0.14 // indirect
18+
github.com/mattn/go-colorable v0.1.13 // indirect
19+
github.com/mattn/go-isatty v0.0.20 // indirect
2120
github.com/pmezard/go-difflib v1.0.0 // indirect
22-
golang.org/x/net v0.2.0 // indirect
23-
golang.org/x/sys v0.2.0 // indirect
24-
golang.org/x/text v0.4.0 // indirect
25-
google.golang.org/protobuf v1.28.1 // indirect
21+
github.com/rogpeppe/go-internal v1.12.0 // indirect
22+
golang.org/x/net v0.22.0 // indirect
23+
golang.org/x/sys v0.18.0 // indirect
24+
golang.org/x/text v0.14.0 // indirect
25+
google.golang.org/genproto/googleapis/api v0.0.0-20240311173647-c811ad7063a7 // indirect
26+
google.golang.org/protobuf v1.33.0 // indirect
2627
gopkg.in/yaml.v3 v3.0.1 // indirect
2728
)

0 commit comments

Comments
 (0)