Skip to content

Commit 2cc38ac

Browse files
committed
chore: update Go, linter, and clean
1 parent 8aceb42 commit 2cc38ac

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
GO_VERSION: stable
16-
GOLANGCI_LINT_VERSION: v1.55.2
16+
GOLANGCI_LINT_VERSION: v1.56.2
1717
CGO_ENABLED: 0
1818

1919
steps:
@@ -26,7 +26,7 @@ jobs:
2626

2727
# https://github.com/marketplace/actions/setup-go-environment
2828
- name: Set up Go ${{ env.GO_VERSION }}
29-
uses: actions/setup-go@v4
29+
uses: actions/setup-go@v5
3030
with:
3131
go-version: ${{ env.GO_VERSION }}
3232

.github/workflows/go-cross.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
# https://github.com/marketplace/actions/setup-go-environment
2828
- name: Set up Go ${{ matrix.go-version }}
29-
uses: actions/setup-go@v4
29+
uses: actions/setup-go@v5
3030
with:
3131
go-version: ${{ matrix.go-version }}
3232

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
# https://github.com/marketplace/actions/setup-go-environment
2424
- name: Set up Go ${{ env.GO_VERSION }}
25-
uses: actions/setup-go@v4
25+
uses: actions/setup-go@v5
2626
with:
2727
go-version: ${{ env.GO_VERSION }}
2828

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine
1+
FROM golang:1.22-alpine
22

33
# cache buster
44
RUN echo 4

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/golangci/misspell
22

3-
go 1.19
3+
go 1.21
44

55
require github.com/gobwas/glob v0.2.3

mime.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"os"
99
"path/filepath"
10+
"slices"
1011
"strings"
1112
)
1213

@@ -77,13 +78,12 @@ func isSCMPath(s string) bool {
7778
if strings.Contains(filepath.Base(s), "EDITMSG") {
7879
return false
7980
}
81+
8082
parts := strings.Split(filepath.Clean(s), string(filepath.Separator))
81-
for _, dir := range parts {
82-
if scm[dir] {
83-
return true
84-
}
85-
}
86-
return false
83+
84+
return slices.ContainsFunc(parts, func(dir string) bool {
85+
return scm[dir]
86+
})
8787
}
8888

8989
var magicHeaders = [][]byte{

replace.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"bytes"
66
"io"
77
"regexp"
8+
"slices"
89
"strings"
910
"text/scanner"
1011
)
@@ -17,12 +18,9 @@ func max(x, y int) int {
1718
}
1819

1920
func inArray(haystack []string, needle string) bool {
20-
for _, word := range haystack {
21-
if strings.EqualFold(needle, word) {
22-
return true
23-
}
24-
}
25-
return false
21+
return slices.ContainsFunc(haystack, func(word string) bool {
22+
return strings.EqualFold(needle, word)
23+
})
2624
}
2725

2826
var wordRegexp = regexp.MustCompile(`[a-zA-Z0-9']+`)
@@ -192,7 +190,7 @@ Loop:
192190
return buf.String(), diffs
193191
}
194192

195-
// Replace is corrects misspellings in input, returning corrected version along with a list of diffs.
193+
// Replace is correcting misspellings in input, returning corrected version along with a list of diffs.
196194
func (r *Replacer) Replace(input string) (string, []Diff) {
197195
output := r.engine.Replace(input)
198196
if input == output {

words_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ func (a sortByLen) Less(i, j int) bool {
1919
return len(a[i]) > len(a[j])
2020
}
2121

22-
func TestWordSort(t *testing.T) {
22+
func Test_wordSort(t *testing.T) {
2323
if len(DictMain)%2 == 1 {
2424
t.Errorf("Dictionary is a not a multiple of 2")
2525
}
26+
2627
words := make([]string, 0, len(DictMain)/2)
2728
for i := 0; i < len(DictMain); i += 2 {
2829
words = append(words, DictMain[i])
2930
}
31+
3032
if !sort.IsSorted(sortByLen(words)) {
3133
t.Errorf("Words not sorted by len, by alpha!")
3234
t.Errorf("Words.go is autogenerated -- do not edit.")

0 commit comments

Comments
 (0)