Skip to content

Commit 1e145f8

Browse files
authored
Merge pull request #112 from jacobbednarz/dependabot/github_actions/golangci/golangci-lint-action-7
Bump golangci/golangci-lint-action from 6 to 7
2 parents 3d5c553 + e4e8082 commit 1e145f8

File tree

8 files changed

+68
-67
lines changed

8 files changed

+68
-67
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ jobs:
1111
name: lint
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: setup go
15-
uses: actions/setup-go@v5
16-
with:
17-
go-version: 1.19
1814
- uses: actions/checkout@v4
19-
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v6
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version-file: "go.mod"
18+
- uses: golangci/golangci-lint-action@v7
2119
with:
2220
version: latest
23-
args: "--config .golintci.yaml"

.github/workflows/test.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@ name: Test
33

44
jobs:
55
test:
6-
strategy:
7-
matrix:
8-
go-version: [1.18, 1.19]
9-
os: [ubuntu-latest, macos-latest, windows-latest]
10-
runs-on: ${{ matrix.os }}
6+
runs-on: ubuntu-latest
117
steps:
12-
- name: setup go
13-
uses: actions/setup-go@v5
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-go@v5
1410
with:
15-
go-version: ${{ matrix.go-version }}
16-
- name: checkout code
17-
uses: actions/checkout@v4
11+
go-version-file: "go.mod"
1812
- name: test
1913
run: go test -v -race ./...

.golangci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
2+
version: "2"
3+
run:
4+
modules-download-mode: readonly
5+
issues-exit-code: 1
6+
tests: true
7+
linters:
8+
enable:
9+
- bodyclose
10+
- contextcheck
11+
- errname
12+
- errorlint
13+
- godot
14+
- misspell
15+
- nilerr
16+
- tparallel
17+
- unparam
18+
- whitespace
19+
exclusions:
20+
generated: lax
21+
presets:
22+
- comments
23+
- common-false-positives
24+
- legacy
25+
- std-error-handling
26+
paths:
27+
- third_party$
28+
- builtin$
29+
- examples$
30+
formatters:
31+
enable:
32+
- gofmt
33+
exclusions:
34+
generated: lax
35+
paths:
36+
- third_party$
37+
- builtin$
38+
- examples$

.golintci.yaml

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

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
module github.com/jacobbednarz/go-csp-collector
22

3-
go 1.19
3+
go 1.23.0
4+
5+
toolchain go1.23.4
46

57
require (
8+
github.com/davidmytton/url-verifier v1.0.1
69
github.com/gorilla/mux v1.8.1
710
github.com/sirupsen/logrus v1.9.3
811
)
912

1013
require (
1114
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
12-
github.com/davidmytton/url-verifier v1.0.1 // indirect
13-
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
15+
github.com/stretchr/testify v1.10.0 // indirect
16+
golang.org/x/sys v0.31.0 // indirect
1417
)

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
1212
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
1313
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
1414
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
15-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
1615
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
17-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
18-
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
16+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
17+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
1918
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
19+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
20+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
2021
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
21-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
2222
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
23+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
24+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/handler/csp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var invalidBlockedURIs = []string{
4242
func TestValidateViolationWithInvalidBlockedURIs(t *testing.T) {
4343
for _, blockedURI := range invalidBlockedURIs {
4444
// Makes the test name more readable for the output.
45-
testName := strings.Replace(blockedURI, "://", "", -1)
45+
testName := strings.ReplaceAll(blockedURI, "://", "")
4646

4747
t.Run(testName, func(t *testing.T) {
4848
rawReport := []byte(fmt.Sprintf(`{

main.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/gorilla/mux"
1515
"github.com/sirupsen/logrus"
16-
log "github.com/sirupsen/logrus"
1716
)
1817

1918
const (
@@ -28,18 +27,18 @@ var (
2827

2928
// Shared defaults for the logger output. This ensures that we are
3029
// using the same keys for the `FieldKey` values across both formatters.
31-
logFieldMapDefaults = log.FieldMap{
32-
log.FieldKeyTime: "timestamp",
33-
log.FieldKeyLevel: "level",
34-
log.FieldKeyMsg: "message",
30+
logFieldMapDefaults = logrus.FieldMap{
31+
logrus.FieldKeyTime: "timestamp",
32+
logrus.FieldKeyLevel: "level",
33+
logrus.FieldKeyMsg: "message",
3534
}
3635
)
3736

3837
var logger = logrus.New()
3938

4039
func init() {
4140
logger.SetOutput(os.Stdout)
42-
logger.SetLevel(log.InfoLevel)
41+
logger.SetLevel(logrus.InfoLevel)
4342
}
4443

4544
func main() {
@@ -64,15 +63,15 @@ func main() {
6463
}
6564

6665
if *debugFlag {
67-
logger.SetLevel(log.DebugLevel)
66+
logger.SetLevel(logrus.DebugLevel)
6867
}
6968

7069
if *outputFormat == "json" {
71-
logger.SetFormatter(&log.JSONFormatter{
70+
logger.SetFormatter(&logrus.JSONFormatter{
7271
FieldMap: logFieldMapDefaults,
7372
})
7473
} else {
75-
logger.SetFormatter(&log.TextFormatter{
74+
logger.SetFormatter(&logrus.TextFormatter{
7675
FullTimestamp: true,
7776
DisableLevelTruncation: true,
7877
QuoteEmptyFields: true,
@@ -88,7 +87,7 @@ func main() {
8887

8988
content, err := os.ReadFile(*blockedURIFile)
9089
if err != nil {
91-
log.Fatalf("error reading Blocked File list: %s", *blockedURIFile)
90+
logrus.Fatalf("error reading Blocked File list: %s", *blockedURIFile)
9291
}
9392
ignoredBlockedURIs = utils.TrimEmptyAndComments(strings.Split(string(content), "\n"))
9493
} else {

0 commit comments

Comments
 (0)