Skip to content

Commit 1328a3b

Browse files
authored
remove mage (#204)
* remove mage, update makefile * fix linter issues * rm linter exclusions * fix naked errors
1 parent 77dbb8e commit 1328a3b

57 files changed

Lines changed: 977 additions & 1148 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ on:
1818
- release-*
1919
env:
2020
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'development' || '' }}
21-
GO_VERSION: "1.23"
22-
GO_RELEASER_VERSION: "v2.3.2"
23-
GO_LANGCI_LINT_VERSION: "v1.61.0"
24-
GO_TESTSUM_VERSION: "1.11.0"
21+
GO_VERSION: "1.25"
22+
GO_RELEASER_VERSION: "v2.8.2"
23+
GO_LANGCI_LINT_VERSION: "v2.4.0"
24+
GO_TESTSUM_VERSION: "1.12.3"
2525

2626
jobs:
2727
test:
2828
runs-on: ubuntu-latest
2929
steps:
3030
-
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3232
-
3333
name: Setup Go
3434
uses: actions/setup-go@v5
3535
with:
3636
go-version: ${{ env.GO_VERSION }}
3737
-
3838
name: Build
39-
uses: goreleaser/goreleaser-action@v5
39+
uses: goreleaser/goreleaser-action@v6
4040
env:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242
with:
@@ -45,7 +45,7 @@ jobs:
4545
args: build --clean --snapshot --single-target
4646
-
4747
name: Lint
48-
uses: golangci/golangci-lint-action@v4
48+
uses: golangci/golangci-lint-action@v8
4949
with:
5050
version: ${{ env.GO_LANGCI_LINT_VERSION }}
5151
args: --timeout=30m
@@ -58,6 +58,8 @@ jobs:
5858
name: Test
5959
run: |
6060
gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./... ./...
61+
gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./oci/... ./oci/...
62+
gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./parser/... ./parser/...
6163
-
6264
name: Upload code coverage
6365
uses: shogo82148/actions-goveralls@v1
@@ -73,7 +75,7 @@ jobs:
7375
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') )
7476
steps:
7577
-
76-
uses: actions/checkout@v4
78+
uses: actions/checkout@v5
7779
with:
7880
fetch-depth: 0
7981
-
@@ -100,7 +102,7 @@ jobs:
100102
eval `ssh-agent`
101103
-
102104
name: Push image to GitHub Container Registry
103-
uses: goreleaser/goreleaser-action@v5
105+
uses: goreleaser/goreleaser-action@v6
104106
env:
105107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106108
with:
@@ -115,7 +117,7 @@ jobs:
115117
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
116118
steps:
117119
-
118-
uses: actions/checkout@v4
120+
uses: actions/checkout@v5
119121
with:
120122
fetch-depth: 0
121123
-
@@ -143,7 +145,7 @@ jobs:
143145
-
144146
name: Pre-release
145147
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-rc')
146-
uses: goreleaser/goreleaser-action@v5
148+
uses: goreleaser/goreleaser-action@v6
147149
env:
148150
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
149151
ASERTO_TAP: ${{ secrets.GH_ASERTO_TAP_TOKEN }}
@@ -154,7 +156,7 @@ jobs:
154156
-
155157
name: Release
156158
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc')
157-
uses: goreleaser/goreleaser-action@v5
159+
uses: goreleaser/goreleaser-action@v6
158160
env:
159161
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
160162
ASERTO_TAP: ${{ secrets.GH_ASERTO_TAP_TOKEN }}
@@ -169,7 +171,7 @@ jobs:
169171
steps:
170172
-
171173
name: Checkout
172-
uses: actions/checkout@v4
174+
uses: actions/checkout@v5
173175
with:
174176
fetch-depth: 0
175177
-

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Checkout repository
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3232

3333
# Initializes the CodeQL tools for scanning.
3434
- name: Initialize CodeQL

.github/workflows/gitleaks-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
-
10-
uses: actions/checkout@v4
10+
uses: actions/checkout@v5
1111
with:
1212
fetch-depth: 0
1313
-

.golangci.yaml

Lines changed: 88 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,96 @@
11
---
2-
# golangci.com configuration
3-
# https://github.com/golangci/golangci/wiki/Configuration
2+
# Configuration
3+
# https://golangci-lint.run/usage/configuration/
44

5-
linters-settings:
6-
depguard:
7-
list-type: blacklist
8-
packages:
9-
# logging is allowed only by zerolog
10-
- github.com/sirupsen/logrus
11-
packages-with-error-message:
12-
- github.com/sirupsen/logrus: "logging is allowed only by zerolog"
13-
dupl:
14-
threshold: 100
15-
funlen:
16-
lines: 100
17-
statements: 80
18-
gci:
19-
prefix: github.com/golangci/golangci-lint
20-
goconst:
21-
min-len: 2
22-
min-occurrences: 2
23-
gocritic:
24-
enabled-tags:
25-
- diagnostic
26-
- experimental
27-
- opinionated
28-
- performance
29-
- style
30-
disabled-checks:
31-
- dupImport # https://github.com/go-critic/go-critic/issues/845
32-
- ifElseChain
33-
- octalLiteral
34-
- whyNoLint
35-
- wrapperFunc
36-
gocyclo:
37-
min-complexity: 18
38-
goimports:
39-
prefix: github.com/golangci/golangci-lint
40-
golint:
41-
min-confidence: 0
42-
govet:
43-
shadow: true
44-
settings:
45-
printf:
46-
funcs:
47-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
48-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
49-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
50-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
51-
maligned:
52-
suggest-new: true
53-
misspell:
54-
locale: US
55-
nolintlint:
56-
allow-unused: false # report any unused nolint directives
57-
require-explanation: false # don't require an explanation for nolint directives
58-
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
5+
version: "2"
596

607
linters:
61-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
62-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
63-
disable-all: true
64-
enable:
65-
- asciicheck
66-
- bodyclose
67-
- dogsled
68-
- errcheck
8+
# https://golangci-lint.run/usage/configuration/#linters-configuration
9+
default: all
10+
11+
# explicitly disabled linters
12+
disable:
13+
- containedctx
14+
- contextcheck
15+
- cyclop
16+
- depguard
17+
- errcheck
18+
- exhaustruct
6919
- exhaustive
70-
- funlen
71-
- gochecknoinits
72-
- goconst
73-
- gocritic
74-
- gocyclo
75-
- godot
76-
- err113
77-
- gofmt
78-
- goimports
79-
- goprintffuncname
80-
- gosec
81-
- gosimple
82-
- govet
83-
- ineffassign
84-
- misspell
85-
- nakedret
86-
- noctx
87-
# - rowserrcheck disabled https://github.com/golangci/golangci-lint/issues/2649.
88-
- staticcheck
89-
- stylecheck
90-
- testpackage
91-
- typecheck
92-
- unconvert
93-
- unparam
94-
- unused
20+
- forbidigo
21+
- gochecknoglobals # no configuration options
22+
- nilnil
23+
- nlreturn # redundant with wsl
24+
- noinlineerr
25+
- paralleltest
26+
- revive
27+
- tagalign
28+
- thelper
29+
- varnamelen
30+
- wrapcheck
31+
- wsl
32+
33+
settings:
34+
cyclop:
35+
max-complexity: 12
36+
37+
errcheck:
38+
exclude-functions:
39+
- fmt.Fprint
40+
- fmt.Fprintf
41+
- fmt.Fprintln
42+
- os.Close
43+
44+
funlen:
45+
lines: 80
46+
statements: 60
47+
ignore-comments: true
48+
49+
gomoddirectives:
50+
replace-allow-list:
51+
- github.com/slok/go-http-metrics
9552

96-
# don't enable:
97-
# - dupl
98-
# - gochecknoglobals
99-
# - gocognit
100-
# - godox
101-
# - gomnd
102-
# - lll
103-
# - nestif
104-
# - nolintlint # conflict with 1.19 gofmt changes
105-
# - prealloc
106-
# - revive
107-
# - wsl
108-
# - whitespace
53+
gosec:
54+
excludes:
55+
- G104 # Errors unhandled
56+
- G304 # Potential file inclusion via variable (see https://github.com/golang/go/issues/67002)
10957

110-
issues:
111-
# List of regexps of issue texts to exclude, empty list by default.
112-
# But independently from this option we use default exclude patterns,
113-
# it can be disabled by `exclude-use-default: false`. To list all
114-
# excluded by default patterns execute `golangci-lint run --help`
115-
exclude:
116-
- declaration of "(err|ctx)" shadows declaration at
117-
- shadow of imported from 'github.com/stretchr/testify/assert' package 'assert'
118-
# Excluding configuration per-path, per-linter, per-text and per-source
119-
exclude-rules:
120-
- path: _test\.go
121-
linters:
122-
- gomnd
123-
# https://github.com/go-critic/go-critic/issues/926
124-
- text: "unnecessaryDefer:"
125-
linters:
126-
- gocritic
127-
- text: "unnamedResult:"
128-
linters:
129-
- gocritic
130-
- path: \.resolvers\.go
131-
text: "typeDefFirst:"
132-
linters:
133-
- gocritic
134-
- path: \.resolvers\.go
135-
text: "paramTypeCombine:"
136-
linters:
137-
- gocritic
138-
- path: \.resolvers\.go
139-
text: "hugeParam:"
140-
linters:
141-
- gocritic
142-
- text: "G404"
143-
linters:
144-
- gosec
58+
ireturn:
59+
allow:
60+
- error
61+
- empty
62+
- stdlib
63+
- generic
64+
- kong.Resolver
14565

146-
run:
147-
timeout: 5m
66+
lll:
67+
line-length: 150
68+
69+
recvcheck:
70+
exclusions:
71+
- "*.Map"
72+
73+
tagliatelle:
74+
case:
75+
rules:
76+
json: snake
77+
yaml: snake
78+
79+
overrides:
80+
- pkg: pkg/app
81+
rules:
82+
json: camel
83+
84+
wsl_v5:
85+
allow-first-in-block: true
86+
allow-whole-block: false
87+
branch-max-lines: 2
88+
89+
exclusions:
90+
generated: lax
91+
92+
formatters:
93+
enable:
94+
- gofmt
95+
- gofumpt
96+
- goimports

.goreleaser-pre.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ builds:
4040

4141
archives:
4242
# https://goreleaser.com/customization/archive/
43-
- format: zip
44-
builds:
43+
- formats:
44+
- zip
45+
ids:
4546
- build
4647
files:
4748
- LICENSE

.goreleaser.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: 2
2+
23
project_name: policy
34

45
env:
@@ -40,8 +41,9 @@ builds:
4041

4142
archives:
4243
# https://goreleaser.com/customization/archive/
43-
- format: zip
44-
builds:
44+
- formats:
45+
- zip
46+
ids:
4547
- build
4648
files:
4749
- LICENSE

0 commit comments

Comments
 (0)