Skip to content

Commit f5125e8

Browse files
committed
Update go version to 1.25 and update golang-lint version 2.5.0
1 parent 158e43e commit f5125e8

File tree

5 files changed

+78
-47
lines changed

5 files changed

+78
-47
lines changed

.golangci.yml

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,81 @@
1-
# More info on config here: https://golangci-lint.run/usage/configuration/#config-file
1+
version: "2"
22
run:
33
concurrency: 8
4-
timeout: 10m
54
issues-exit-code: 1
65
tests: true
7-
8-
output:
9-
formats:
10-
- format: colored-line-number
11-
print-issued-lines: true
12-
print-linter-name: true
13-
14-
linters-settings:
15-
govet:
16-
enable:
17-
- shadow
18-
dupl:
19-
threshold: 100
20-
goconst:
21-
min-len: 2
22-
min-occurrences: 2
23-
246
linters:
25-
disable-all: true
7+
default: none
268
enable:
9+
- dupl
10+
- durationcheck
11+
- errorlint
2712
- errcheck
2813
- goconst
29-
- goimports
3014
- gosec
31-
- gosimple
3215
- govet
3316
- ineffassign
3417
- revive
3518
- staticcheck
3619
- unused
37-
38-
issues:
39-
exclude-dirs:
40-
- bin
41-
- vendor
42-
- var
43-
- tmp
44-
- .cache
45-
exclude-use-default: false
46-
exclude:
47-
- G104
48-
- G115
49-
- G204
50-
- should have a package comment
51-
- should have comment or be unexported
52-
- comment on exported const
53-
- should have comment \(or a comment on this block\)
54-
- don't use an underscore in package name
55-
- package-comments
20+
- wsl_v5
21+
settings:
22+
dupl:
23+
threshold: 100
24+
goconst:
25+
min-len: 2
26+
min-occurrences: 2
27+
govet:
28+
enable:
29+
- shadow
30+
wsl_v5:
31+
enable:
32+
- assign
33+
- branch
34+
- decl
35+
- defer
36+
- expr
37+
- for
38+
- go
39+
- if
40+
- inc-dec
41+
- label
42+
- range
43+
- return
44+
- select
45+
- switch
46+
- type-switch
47+
- append
48+
- assign-expr
49+
- err
50+
- leading-whitespace
51+
- trailing-whitespace
52+
exclusions:
53+
generated: lax
54+
rules:
55+
- path: (.+)\.go$
56+
text: G104
57+
- path: (.+)\.go$
58+
text: G115
59+
- path: (.+)\.go$
60+
text: G204
61+
- path: (.+)\.go$
62+
text: should have a package comment
63+
- path: (.+)\.go$
64+
text: should have comment or be unexported
65+
- path: (.+)\.go$
66+
text: comment on exported const
67+
- path: (.+)\.go$
68+
text: should have comment \(or a comment on this block\)
69+
- path: (.+)\.go$
70+
text: don't use an underscore in package name
71+
- path: (.+)\.go$
72+
text: package-comments
73+
paths:
74+
- bin
75+
- vendor
76+
- var
77+
- tmp
78+
- .cache
79+
- third_party$
80+
- builtin$
81+
- examples$

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CURDIR_ESCAPE:=$(subst $(space),\ ,$(CURDIR))
1010

1111
LOCAL_BIN:=$(CURDIR_ESCAPE)/bin
1212
LINT_BIN:=$(LOCAL_BIN)/golangci-lint
13-
LINT_VERSION:=1.60.3
13+
LINT_VERSION:=2.5.0
1414

1515
###### TEST ######
1616
.PHONY: test
@@ -23,13 +23,12 @@ test:
2323
install-lint:
2424
ifeq ($(wildcard $(LINT_BIN)),)
2525
$(info Installing golangci-lint v$(LINT_VERSION))
26-
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(LINT_VERSION)
26+
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$(LINT_VERSION)
2727
# Устанавливаем текущий путь для исполняемого файла линтера.
2828
else
2929
$(info Golangci-lint is already installed to $(LINT_VERSION))
3030
endif
3131

32-
3332
PHONY: lint
3433
lint: install-lint
3534
$(info Running lint against changed files...)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/Format-C-eft/git-update
22

3-
go 1.23
3+
go 1.25

internal/cmd/dto.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ func (r *resultLog) String() string {
5050
),
5151
)
5252
}
53+
5354
return strings.Join(result, "\n")
5455
}

internal/cmd/run.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ func Run() error {
5454
ctx, cancel := context.WithTimeout(context.Background(), execTimeout)
5555
defer cancel()
5656

57-
var countDone atomic.Int32
58-
var countAll = int32(len(listDir))
57+
var (
58+
countDone atomic.Int32
59+
countAll = int32(len(listDir))
60+
)
5961

6062
for {
6163
select {
@@ -64,6 +66,7 @@ func Run() error {
6466
case logChan := <-ch:
6567
fmt.Println(logChan.String())
6668
fmt.Println("--------------------------------------------------------------------")
69+
6770
if newValue := countDone.Add(1); newValue >= countAll {
6871
return nil
6972
}
@@ -93,6 +96,7 @@ func processDir(dir string, ch chan resultLog) {
9396

9497
defer func() {
9598
resultLogs.AddLog("stop processing", "")
99+
96100
ch <- resultLogs
97101
}()
98102

@@ -112,6 +116,7 @@ func processDir(dir string, ch chan resultLog) {
112116
resultLogs.AddLog("skipped: there are uncommitted changes", "")
113117
return
114118
}
119+
115120
result, err := shell_executor.Run(ctx, dir, "git", "reset", "--hard")
116121
if err != nil {
117122
resultLogs.AddLog("error: git reset --hard", err.Error())

0 commit comments

Comments
 (0)