Skip to content

Commit eaeb1ba

Browse files
committed
bump golangci to v2 & go to 1.23
1 parent 829146f commit eaeb1ba

File tree

6 files changed

+91
-54
lines changed

6 files changed

+91
-54
lines changed

.github/workflows/go_test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
strategy:
1313
matrix:
1414
go-version:
15-
- "1.21"
16-
- "1.22"
1715
- "1.23"
1816
- "1.24"
1917
name: lint and test
@@ -28,6 +26,6 @@
2826
- name: golangci-lint
2927
uses: golangci/[email protected]
3028
with:
31-
version: v1.64.5
29+
version: v2.1.5
3230
- name: test
3331
run: make test_ci

.golangci.bck.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
run:
2+
timeout: 5m
3+
issues-exit-code: 1
4+
tests: true
5+
6+
issues:
7+
max-same-issues: 100
8+
include:
9+
- EXC0012
10+
- EXC0014
11+
exclude-dirs:
12+
- local
13+
exclude-rules:
14+
- path: example_test.go
15+
linters:
16+
- revive
17+
text: "seems to be unused"
18+
fix: true
19+
20+
linters:
21+
enable:
22+
- bodyclose
23+
- copyloopvar
24+
- gofumpt
25+
- goimports
26+
- gosimple
27+
- govet
28+
- ineffassign
29+
- misspell
30+
- revive
31+
- staticcheck
32+
- typecheck
33+
- unused
34+
- whitespace
35+
36+
output:
37+
formats:
38+
- format: colored-line-number
39+
print-issued-lines: true
40+
print-linter-name: true
41+
path-prefix: ""
42+
sort-results: true

.golangci.yaml

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,51 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
issues-exit-code: 1
44
tests: true
5-
6-
issues:
7-
max-same-issues: 100
8-
include:
9-
- EXC0012
10-
- EXC0014
11-
exclude-dirs:
12-
- local
13-
exclude-rules:
14-
- path: example_test.go
15-
linters:
16-
- revive
17-
text: "seems to be unused"
18-
fix: true
19-
5+
output:
6+
formats:
7+
text:
8+
path: stdout
9+
print-linter-name: true
10+
print-issued-lines: true
11+
path-prefix: ""
2012
linters:
2113
enable:
2214
- bodyclose
2315
- copyloopvar
24-
- gofumpt
25-
- goimports
26-
- gosimple
27-
- govet
28-
- ineffassign
2916
- misspell
3017
- revive
31-
- staticcheck
32-
- typecheck
33-
- unused
3418
- whitespace
35-
36-
output:
37-
formats:
38-
- format: colored-line-number
39-
print-issued-lines: true
40-
print-linter-name: true
41-
path-prefix: ""
42-
sort-results: true
19+
exclusions:
20+
generated: lax
21+
presets:
22+
- common-false-positives
23+
- legacy
24+
- std-error-handling
25+
rules:
26+
- linters:
27+
- revive
28+
path: example_test.go
29+
text: seems to be unused
30+
- linters:
31+
- revive
32+
text: package-comments
33+
paths:
34+
- local
35+
- third_party$
36+
- builtin$
37+
- examples$
38+
issues:
39+
max-same-issues: 100
40+
fix: true
41+
formatters:
42+
enable:
43+
- gofumpt
44+
- goimports
45+
exclusions:
46+
generated: lax
47+
paths:
48+
- local
49+
- third_party$
50+
- builtin$
51+
- examples$

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-added-large-files
88
- id: check-case-conflict
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/golangci/golangci-lint
15-
rev: v1.64.5
15+
rev: v2.1.5
1616
hooks:
1717
- id: golangci-lint
1818
- repo: https://github.com/TekWizely/pre-commit-golang

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/go-co-op/gocron/v2
22

3-
go 1.21.0
3+
go 1.23.0
44

55
require (
66
github.com/google/uuid v1.6.0

scheduler_test.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,10 +1626,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
16261626
func(t *testing.T) {
16271627
timeout := time.Now().Add(1 * time.Second)
16281628
var notLeaderCount int
1629-
for {
1630-
if time.Now().After(timeout) {
1631-
break
1632-
}
1629+
for !time.Now().After(timeout) {
16331630
select {
16341631
case <-notLeader:
16351632
notLeaderCount++
@@ -1650,10 +1647,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
16501647
func(_ *testing.T) {
16511648
timeout := time.Now().Add(1 * time.Second)
16521649
var notLockedCount int
1653-
for {
1654-
if time.Now().After(timeout) {
1655-
break
1656-
}
1650+
for !time.Now().After(timeout) {
16571651
select {
16581652
case <-notLocked:
16591653
notLockedCount++
@@ -1675,10 +1669,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
16751669
func(_ *testing.T) {
16761670
timeout := time.Now().Add(1 * time.Second)
16771671
var notLockedCount int
1678-
for {
1679-
if time.Now().After(timeout) {
1680-
break
1681-
}
1672+
for !time.Now().After(timeout) {
16821673
select {
16831674
case <-notLocked:
16841675
notLockedCount++
@@ -1702,10 +1693,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
17021693
func(_ *testing.T) {
17031694
timeout := time.Now().Add(1 * time.Second)
17041695
var notLockedCount int
1705-
for {
1706-
if time.Now().After(timeout) {
1707-
break
1708-
}
1696+
for !time.Now().After(timeout) {
17091697
select {
17101698
case <-notLocked:
17111699
notLockedCount++

0 commit comments

Comments
 (0)