Skip to content

Commit e4ce850

Browse files
authored
Updated golang-lint version and migrate configurations (#60)
* Updated golang-lint version and migrate configurations * Added formatters
1 parent 4b68ca9 commit e4ce850

5 files changed

Lines changed: 20 additions & 18 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
egress-policy: audit
4141

4242
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43-
- uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
43+
- uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
4444
with:
4545
# must be specified without patch version
4646
version: latest

.golangci.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1+
version: "2"
12
run:
2-
timeout: 10m
3-
43
# Run linters over integration tests
54
build-tags:
65
- integration
76

87
linters:
9-
disable-all: true # Disable defaults, then enable the ones we want
8+
default: none
109
enable:
11-
# - deadcode
10+
- bodyclose
1211
- errcheck
13-
- gosimple
12+
- gosec
1413
- govet
1514
- ineffassign
1615
- staticcheck
17-
# - structcheck
18-
- typecheck
1916
- unused
20-
# - varcheck
21-
- bodyclose
22-
- stylecheck
23-
- gosec
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- comments
21+
- common-false-positives
22+
- legacy
23+
- std-error-handling
24+
formatters:
25+
enable:
26+
- gofmt
2427
- goimports
25-
- gci

cmd/cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestCli(t *testing.T) {
9696
</index>`
9797
wd, _ := os.Getwd()
9898
wd = filepath.ToSlash(wd)
99-
expected = strings.Replace(expected, "XX", wd, -1)
99+
expected = strings.ReplaceAll(expected, "XX", wd)
100100
s := string(out)
101101
sa, se, _ := strings.Cut(s, "timestamp") // cut out time, cannot compare
102102
_, se, _ = strings.Cut(se, "timestamp")

cmd/pidx_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func TestPidxXML_Update(t *testing.T) {
338338
</pindex>
339339
</index>`
340340
if runtime.GOOS == "windows" {
341-
expected = strings.Replace(expected, "///uu", "//C:/uu", -1)
341+
expected = strings.ReplaceAll(expected, "///uu", "//C:/uu")
342342
}
343343
s := string(out)
344344
sa, se, _ := strings.Cut(s, "timestamp") // cut out time, cannot compare

cmd/utils_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestReadURL(t *testing.T) {
118118
goodServer := httptest.NewServer(
119119
http.HandlerFunc(
120120
func(w http.ResponseWriter, r *http.Request) {
121-
fmt.Fprintln(w, goodResponse)
121+
fmt.Fprintln(w, string(goodResponse))
122122
},
123123
),
124124
)
@@ -142,7 +142,7 @@ func TestReadURL(t *testing.T) {
142142
goodServer := httptest.NewServer(
143143
http.HandlerFunc(
144144
func(w http.ResponseWriter, r *http.Request) {
145-
fmt.Fprintln(w, goodResponse)
145+
fmt.Fprintln(w, string(goodResponse))
146146
},
147147
),
148148
)
@@ -157,7 +157,7 @@ func TestReadURL(t *testing.T) {
157157
goodServer := httptest.NewServer(
158158
http.HandlerFunc(
159159
func(w http.ResponseWriter, r *http.Request) {
160-
fmt.Fprintln(w, goodResponse)
160+
fmt.Fprintln(w, string(goodResponse))
161161
},
162162
),
163163
)

0 commit comments

Comments
 (0)