Skip to content

Commit 1defae6

Browse files
committed
go1.24, golangci-lint v2.2.0 + updated config
1 parent 6335bf5 commit 1defae6

File tree

16 files changed

+70
-53
lines changed

16 files changed

+70
-53
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515

1616
- name: Set up Go
17-
uses: actions/setup-go@v2
17+
uses: actions/setup-go@v5
1818
with:
19-
go-version: 1.23
19+
go-version: 1.24
2020

2121
- name: Build
2222
run: go build -v ./...

.github/workflows/golangci-lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
name: lint
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/setup-go@v3
19+
- uses: actions/setup-go@v5
2020
with:
21-
go-version: 1.23
22-
- uses: actions/checkout@v3
21+
go-version: 1.24
22+
- uses: actions/checkout@v4
2323
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v3
24+
uses: golangci/golangci-lint-action@v8
2525
with:
2626
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27-
version: v1.61.0
27+
version: v2.2.0
2828

2929
# Optional: working directory, useful for monorepos
3030
# working-directory: somedir

.github/workflows/release-binary.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: "Check out code"
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
1717

1818
- name: "Set up Go"
19-
uses: actions/setup-go@v4
19+
uses: actions/setup-go@v5
2020
with:
21-
go-version: 1.23.x
21+
go-version: 1.24
2222

2323
- name: "Create release on GitHub"
2424
timeout-minutes: 10
25-
uses: goreleaser/goreleaser-action@v4
25+
uses: goreleaser/goreleaser-action@v6
2626
with:
2727
args: "release --clean"
2828
version: latest

.github/workflows/release-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: "Check out code"
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v4
20+
uses: actions/setup-go@v5
2121
with:
22-
go-version: 1.23.x
22+
go-version: 1.24
2323

2424
- name: release test
25-
uses: goreleaser/goreleaser-action@v4
25+
uses: goreleaser/goreleaser-action@v6
2626
with:
2727
args: "release --clean --snapshot"
28-
version: latest
28+
version: latest
29+
env:
30+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.golangci.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
version: "2"
12
linters:
2-
# Enable all available linters.
3-
# Default: false
4-
disable-all: true
3+
default: none
54
enable:
65
- asciicheck
76
- bodyclose
@@ -20,10 +19,8 @@ linters:
2019
- goheader
2120
- gomodguard
2221
- goprintffuncname
23-
- gosimple
2422
- govet
2523
- ineffassign
26-
- lll
2724
- misspell
2825
- mnd
2926
- nakedret
@@ -32,24 +29,24 @@ linters:
3229
- rowserrcheck
3330
- sqlclosecheck
3431
- staticcheck
35-
- stylecheck
3632
- testpackage
37-
- typecheck
3833
- unconvert
3934
- unparam
4035
- unused
4136
- whitespace
42-
- wsl
43-
44-
linters-settings:
45-
wsl:
46-
strict-append: false
47-
enforce-err-cuddling: true
48-
49-
mnd:
50-
# Values always ignored: "1", "1.0", "0" and "0.0"
51-
# Default: []
52-
ignored-numbers:
53-
- '2'
54-
ignored-files:
55-
- 'crawler/useragents.go'
37+
- wsl_v5
38+
exclusions:
39+
generated: lax
40+
presets:
41+
- std-error-handling
42+
paths:
43+
- third_party$
44+
- builtin$
45+
- examples$
46+
formatters:
47+
exclusions:
48+
generated: lax
49+
paths:
50+
- third_party$
51+
- builtin$
52+
- examples$

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/edoardottt/cariddi
22

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/fatih/color v1.18.0

internal/file/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ func ReadHTTPRequestFromFile(inputFile string) (*http.Request, error) {
192192
defer f.Close()
193193

194194
buf := bufio.NewReader(f)
195-
req, err := http.ReadRequest(buf)
196195

196+
req, err := http.ReadRequest(buf)
197197
if err != nil {
198198
fmt.Println("Cannot read request from input file.")
199199
return req, err

internal/slice/slice.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import (
3333
"time"
3434
)
3535

36+
const (
37+
coupleSize = 2
38+
)
39+
3640
// RemoveDuplicateValues removes duplicates from a slice
3741
// of strings.
3842
func RemoveDuplicateValues(strSlice []string) []string {
@@ -86,7 +90,7 @@ func CheckCookies(input string) []*http.Cookie {
8690

8791
for _, pair := range pairs {
8892
couple := strings.Split(pair, ":")
89-
if len(couple) != 2 {
93+
if len(couple) != coupleSize {
9094
continue
9195
}
9296

pkg/crawler/colly.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func New(scan *Scan) *Results {
6868

6969
if scan.Intensive {
7070
var err error
71-
targetTemp, err = urlUtils.GetRootHost(fmt.Sprintf("%s://%s", protocolTemp, targetTemp))
7271

72+
targetTemp, err = urlUtils.GetRootHost(fmt.Sprintf("%s://%s", protocolTemp, targetTemp))
7373
if err != nil {
7474
fmt.Println(err.Error())
7575
os.Exit(1)
@@ -153,8 +153,8 @@ func New(scan *Scan) *Results {
153153
filetype := &scanner.FileType{}
154154

155155
// Skip if no scanning is enabled
156-
if !(scan.EndpointsFlag || scan.SecretsFlag || (1 <= scan.FileType && scan.FileType <= 7) ||
157-
scan.ErrorsFlag || scan.InfoFlag || scan.JSON) {
156+
if !scan.EndpointsFlag && !scan.SecretsFlag && (scan.FileType < 1 || scan.FileType > 7) &&
157+
!scan.ErrorsFlag && !scan.InfoFlag && !scan.JSON {
158158
return
159159
}
160160

@@ -201,7 +201,6 @@ func New(scan *Scan) *Results {
201201
jsonOutput, err := output.GetJSONString(
202202
r, secrets, parameters, filetype, errors, infos,
203203
)
204-
205204
if err == nil {
206205
fmt.Println(string(jsonOutput))
207206
} else {

pkg/crawler/scan.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ func huntSecrets(target, body string, secretsFile *[]string) []scanner.SecretMat
7373
}
7474

7575
mu.Lock()
76+
7677
secrets = append(secrets, secretMatch)
78+
7779
mu.Unlock()
7880
}
7981
}(secret)
@@ -108,7 +110,9 @@ func huntSecrets(target, body string, secretsFile *[]string) []scanner.SecretMat
108110
}
109111

110112
mu.Lock()
113+
111114
secrets = append(secrets, secretMatch)
115+
112116
mu.Unlock()
113117
}
114118
}(re)
@@ -140,6 +144,7 @@ func EndpointsMatch(target string, endpointsFile *[]string) []scanner.EndpointMa
140144
}
141145
}
142146
}
147+
143148
endpoints = append(endpoints, scanner.EndpointMatched{Parameters: matched, URL: target})
144149
} else {
145150
for _, parameter := range *endpointsFile {
@@ -149,6 +154,7 @@ func EndpointsMatch(target string, endpointsFile *[]string) []scanner.EndpointMa
149154
}
150155
}
151156
}
157+
152158
endpoints = append(endpoints, scanner.EndpointMatched{Parameters: matched, URL: target})
153159
}
154160

@@ -203,7 +209,9 @@ func huntErrors(target, body string) []scanner.ErrorMatched {
203209
}
204210

205211
mutex.Lock()
212+
206213
results = append(results, localResults...)
214+
207215
mutex.Unlock()
208216
}(err)
209217
}
@@ -231,7 +239,9 @@ func huntInfos(target, body string) []scanner.InfoMatched {
231239

232240
for _, match := range matches {
233241
mu.Lock()
242+
234243
infosSlice = append(infosSlice, scanner.InfoMatched{Info: infoItem, URL: target, Match: match[0]})
244+
235245
mu.Unlock()
236246
}
237247
}(infoItem)

0 commit comments

Comments
 (0)