Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15bc0ca

Browse files
committed
chore: update CI
1 parente78f9b6 commit15bc0ca

File tree

15 files changed

+135
-23
lines changed

15 files changed

+135
-23
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515
runs-on:ubuntu-latest
1616
env:
1717
GO_VERSION:stable
18-
GOLANGCI_LINT_VERSION:v2.1
18+
GOLANGCI_LINT_VERSION:v2.4
1919
CGO_ENABLED:0
2020

2121
steps:
2222

2323
# https://github.com/marketplace/actions/checkout
2424
-name:Check out code
25-
uses:actions/checkout@v4
25+
uses:actions/checkout@v5
2626

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

@@ -44,7 +44,7 @@ jobs:
4444
git diff --exit-code words_us.go
4545
4646
-name:golangci-lint
47-
uses:golangci/golangci-lint-action@v7
47+
uses:golangci/golangci-lint-action@v8
4848
with:
4949
version:${{ env.GOLANGCI_LINT_VERSION }}
5050

‎.github/workflows/go-cross.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
os:[ubuntu-latest, macos-latest, windows-latest]
2323

2424
steps:
25-
-uses:actions/checkout@v4
26-
-uses:actions/setup-go@v5
25+
-uses:actions/checkout@v5
26+
-uses:actions/setup-go@v6
2727
with:
2828
go-version:${{ matrix.go-version }}
2929

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ jobs:
1414
CGO_ENABLED:0
1515

1616
steps:
17-
-uses:actions/checkout@v4
17+
-uses:actions/checkout@v5
1818
with:
1919
fetch-depth:0
20-
-uses:actions/setup-go@v5
20+
-uses:actions/setup-go@v6
2121
with:
2222
go-version:${{ env.GO_VERSION }}
2323

2424
# https://goreleaser.com/ci/actions/
2525
-name:Run GoReleaser
26-
uses:goreleaser/goreleaser-action@v5
26+
uses:goreleaser/goreleaser-action@v6
2727
with:
2828
version:latest
2929
args:release --clean

‎.golangci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ linters:
3737
-tparallel
3838
-varnamelen
3939
-wrapcheck
40-
-wsl#FIXME(ldez) must be fixed
40+
-wsl#deprecated
4141

4242
settings:
4343
depguard:

‎ascii.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ func ByteToUpper(x byte) byte {
77
c:=b-byte(0x61)
88
d:=^(b-byte(0x7b))
99
e:= (c&d)& (^x&0x7f)
10+
1011
returnx- (e>>2)
1112
}
1213

@@ -16,6 +17,7 @@ func ByteToLower(eax byte) byte {
1617
ebx:=eax&byte(0x7f)+byte(0x25)
1718
ebx=ebx&byte(0x7f)+byte(0x1a)
1819
ebx= ((ebx&^eax)>>2)&byte(0x20)
20+
1921
returneax+ebx
2022
}
2123

@@ -32,18 +34,21 @@ func StringEqualFold(s1, s2 string) bool {
3234
iflen(s1)!=len(s2) {
3335
returnfalse
3436
}
37+
3538
fori:=rangelen(s1) {
3639
c1:=s1[i]
3740
c2:=s2[i]
3841
// c1 & c2
3942
ifc1!=c2 {
4043
c1|='a'-'A'
44+
4145
c2|='a'-'A'
4246
ifc1!=c2||c1<'a'||c1>'z' {
4347
returnfalse
4448
}
4549
}
4650
}
51+
4752
returntrue
4853
}
4954

@@ -53,8 +58,10 @@ func StringHasPrefixFold(s1, s2 string) bool {
5358
iflen(s1)<len(s2) {
5459
returnfalse
5560
}
61+
5662
iflen(s1)==len(s2) {
5763
returnStringEqualFold(s1,s2)
5864
}
65+
5966
returnStringEqualFold(s1[:len(s2)],s2)
6067
}

‎benchmark_test.go‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ func init() {
1818
buf:= bytes.Buffer{}
1919
fori:=0;i<len(DictMain);i+=2 {
2020
buf.WriteString(DictMain[i+1]+" ")
21+
2122
ifi%5==0 {
2223
buf.WriteString("\n")
2324
}
2425
}
26+
2527
sampleClean=buf.String()
2628
sampleDirty=sampleClean+DictMain[0]+"\n"
2729
rep=New()
@@ -31,9 +33,13 @@ func init() {
3133
funcBenchmarkCleanString(b*testing.B) {
3234
b.ResetTimer()
3335
b.ReportAllocs()
34-
varupdatedstring
35-
vardiffs []Diff
36-
varcountint
36+
37+
var (
38+
updatedstring
39+
diffs []Diff
40+
countint
41+
)
42+
3743
forn:=0;n<b.N;n++ {//nolint:intrange // use Loop -> go1.24
3844
updated,diffs=rep.Replace(sampleClean)
3945
count+=len(diffs)
@@ -52,9 +58,11 @@ func discardDiff(_ Diff) {
5258
funcBenchmarkCleanStream(b*testing.B) {
5359
b.ResetTimer()
5460
b.ReportAllocs()
61+
5562
tmpCount=0
5663
buf:=bytes.NewBufferString(sampleClean)
5764
out:=bytes.NewBuffer(make([]byte,0,len(sampleClean)+100))
65+
5866
forn:=0;n<b.N;n++ {//nolint:intrange // use Loop -> go1.24
5967
buf.Reset()
6068
buf.WriteString(sampleClean)
@@ -70,6 +78,7 @@ func BenchmarkCleanStreamDiscard(b *testing.B) {
7078

7179
buf:=bytes.NewBufferString(sampleClean)
7280
tmpCount=0
81+
7382
forn:=0;n<b.N;n++ {//nolint:intrange // use Loop -> go1.24
7483
buf.Reset()
7584
buf.WriteString(sampleClean)
@@ -81,9 +90,13 @@ func BenchmarkCleanStreamDiscard(b *testing.B) {
8190
funcBenchmarkDirtyString(b*testing.B) {
8291
b.ResetTimer()
8392
b.ReportAllocs()
84-
varupdatedstring
85-
vardiffs []Diff
86-
varcountint
93+
94+
var (
95+
updatedstring
96+
diffs []Diff
97+
countint
98+
)
99+
87100
forn:=0;n<b.N;n++ {//nolint:intrange // use Loop -> go1.24
88101
updated,diffs=rep.Replace(sampleDirty)
89102
count+=len(diffs)
@@ -96,8 +109,10 @@ func BenchmarkDirtyString(b *testing.B) {
96109

97110
funcBenchmarkCompile(b*testing.B) {
98111
r:=New()
112+
99113
b.ReportAllocs()
100114
b.ResetTimer()
115+
101116
forn:=0;n<b.N;n++ {//nolint:intrange // use Loop -> go1.24
102117
r.Compile()
103118
}

‎case.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func CaseStyle(word string) WordCase {
3939
caseupperCount==1&&lowerCount>0&&word[0]>='A'&&word[0]<='Z':
4040
returnCaseTitle
4141
}
42+
4243
returnCaseUnknown
4344
}
4445

‎cmd/misspell/main.go‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ func main() {
9090
if*workers<0 {
9191
log.Fatalf("-j must >= 0")
9292
}
93+
9394
if*workers==0 {
9495
*workers=runtime.NumCPU()
9596
}
97+
9698
if*debugFlag {
9799
*workers=1
98100
}
@@ -152,13 +154,16 @@ func main() {
152154
// Output logger
153155
//
154156
varcleanupfunc()error
157+
155158
output,cleanup=newLogger(*quietFlag,*outFlag)
159+
156160
deferfunc() {_=cleanup() }()
157161

158162
//
159163
// Custom output format
160164
//
161165
varerrerror
166+
162167
defaultWrite,defaultRead,err=createTemplates(*format)
163168
iferr!=nil {
164169
log.Fatal(err)
@@ -176,14 +181,18 @@ func main() {
176181
r.Compile()
177182

178183
args:=flag.Args()
184+
179185
debug.Printf("initialization complete in %v",time.Since(t))
180186

181187
// stdin/stdout
182188
iflen(args)==0 {
183189
// If we are working with pipes/stdin/stdout there is no concurrency,
184190
// so we can directly send data to the writers.
185-
varfileOut io.Writer
186-
varerrOut io.Writer
191+
var (
192+
fileOut io.Writer
193+
errOut io.Writer
194+
)
195+
187196
switch*writeit {
188197
casetrue:
189198
// If we are writing the corrected stream,
@@ -250,12 +259,15 @@ func main() {
250259
iferr==nil&&!info.IsDir() {
251260
c<-path
252261
}
262+
253263
returnnil
254264
})
255265
}
266+
256267
close(c)
257268

258269
count:=0
270+
259271
forrange*workers {
260272
changed:=<-results
261273
count+=changed
@@ -273,6 +285,7 @@ func main() {
273285

274286
funcworker(writeitbool,r*misspell.Replacer,modestring,files<-chanstring,resultschan<-int) {
275287
count:=0
288+
276289
forfilename:=rangefiles {
277290
orig,err:=misspell.ReadTextFile(filename)
278291
iferr!=nil {
@@ -286,8 +299,10 @@ func worker(writeit bool, r *misspell.Replacer, mode string, files <-chan string
286299

287300
debug.Printf("Processing %s",filename)
288301

289-
varupdatedstring
290-
varchanges []misspell.Diff
302+
var (
303+
updatedstring
304+
changes []misspell.Diff
305+
)
291306

292307
ifmode=="go" {
293308
updated,changes=r.ReplaceGo(orig)
@@ -324,6 +339,7 @@ func worker(writeit bool, r *misspell.Replacer, mode string, files <-chan string
324339
os.WriteFile(filename, []byte(updated),0)
325340
}
326341
}
342+
327343
results<-count
328344
}
329345

@@ -332,6 +348,7 @@ func readUserDict(userDictPath string) ([]string, error) {
332348
iferr!=nil {
333349
returnnil,fmt.Errorf("failed to load user defined corrections %q: %w",userDictPath,err)
334350
}
351+
335352
deferfunc() {_=file.Close() }()
336353

337354
reader:=csv.NewReader(file)
@@ -365,11 +382,13 @@ func createTemplates(format string) (writeTmpl, readTmpl *template.Template, err
365382
iferr!=nil {
366383
returnnil,nil,fmt.Errorf("unable to compile log format: %w",err)
367384
}
385+
368386
returntmpl,tmpl,nil
369387

370388
default:// format == ""
371389
writeTmpl=template.Must(template.New("defaultWrite").Parse(defaultWriteTmpl))
372390
readTmpl=template.Must(template.New("defaultRead").Parse(defaultReadTmpl))
391+
373392
return
374393
}
375394
}
@@ -393,6 +412,7 @@ func newLogger(quiet bool, outputPath string) (logger *log.Logger, cleanup func(
393412
iferr!=nil {
394413
log.Fatalf("unable to create outfile %q: %s",outputPath,err)
395414
}
415+
396416
returnlog.New(fo,"",0),fo.Close
397417
}
398418

‎ignore/glob.go‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func (mm *MultiMatch) Match(arg string) bool {
3838
// true, false -> true
3939
// true, true -> false
4040
use:=false
41+
4142
for_,m:=rangemm.matchers {
4243
ifm.Match(arg) {
4344
use=m.True()
@@ -69,9 +70,11 @@ func NewGlobMatch(arg []byte) (*GlobMatch, error) {
6970
truth=false
7071
arg=arg[1:]
7172
}
73+
7274
ifbytes.IndexByte(arg,'/')==-1 {
7375
returnNewBaseGlobMatch(string(arg),truth)
7476
}
77+
7578
returnNewPathGlobMatch(string(arg),truth)
7679
}
7780

@@ -82,6 +85,7 @@ func NewBaseGlobMatch(arg string, truth bool) (*GlobMatch, error) {
8285
iferr!=nil {
8386
returnnil,err
8487
}
88+
8589
return&GlobMatch{orig:arg,matcher:g,normal:truth},nil
8690
}
8791

@@ -98,6 +102,7 @@ func NewPathGlobMatch(arg string, truth bool) (*GlobMatch, error) {
98102
iferr!=nil {
99103
returnnil,err
100104
}
105+
101106
return&GlobMatch{orig:arg,matcher:g,normal:truth},nil
102107
}
103108

@@ -107,7 +112,7 @@ func (g *GlobMatch) True() bool { return g.normal }
107112

108113
// MarshalText is really a debug function.
109114
func (g*GlobMatch)MarshalText() ([]byte,error) {
110-
return[]byte(fmt.Sprintf("\"%s: %v %s\"","GlobMatch",g.normal,g.orig)),nil
115+
returnfmt.Appendf(nil,`"%s: %v %s"`,"GlobMatch",g.normal,g.orig),nil
111116
}
112117

113118
// Match satisfies the Matcher interface.

‎ignore/parse.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
// Parse reads in a gitignore file and returns a Matcher.
88
funcParse(src []byte) (*MultiMatch,error) {
99
varmatchers []Matcher
10+
1011
lines:=bytes.Split(src, []byte{'\n'})
1112

1213
for_,line:=rangelines {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp