Skip to content

Commit 6d2f24f

Browse files
authored
Merge pull request #68 from silenceper/dev
fix lint error
2 parents 6d85727 + ebbed72 commit 6d2f24f

File tree

9 files changed

+62
-90
lines changed

9 files changed

+62
-90
lines changed

.github/workflows/go.yml

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,37 @@
1-
name: Go
1+
name: Go CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
10-
golangci:
11-
strategy:
12-
matrix:
13-
go-version: [ '1.16','1.17','1.18','1.19','1.20' ]
14-
name: golangci-lint
10+
test:
11+
name: Test and Lint
1512
runs-on: ubuntu-latest
1613
steps:
17-
- name: Setup Golang ${{ matrix.go-version }}
18-
uses: actions/setup-go@v4
19-
with:
20-
go-version: ${{ matrix.go-version }}
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v3
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
2519
with:
26-
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
27-
version: v1.52.2
28-
build:
29-
name: Test
30-
runs-on: ubuntu-latest
20+
go-version: "1.23"
21+
check-latest: true
22+
cache: true
3123

32-
strategy:
33-
matrix:
34-
go-version: [ '1.16','1.17','1.18','1.19','1.20' ]
24+
- name: Verify dependencies
25+
run: go mod verify
3526

36-
steps:
37-
- name: Setup Golang ${{ matrix.go-version }}
38-
uses: actions/setup-go@v4
27+
- name: Install golangci-lint
28+
uses: golangci/golangci-lint-action@v7
3929
with:
40-
go-version: ${{ matrix.go-version }}
41-
- name: Checkout
42-
uses: actions/checkout@v3
43-
- name: Test
44-
run: go test -v -race ./...
30+
version: latest
31+
args: --timeout=5m
32+
33+
- name: Run tests
34+
run: go test -v -race -timeout 10m ./...
4535

36+
- name: Build
37+
run: go build -v ./...

.github/workflows/goreleaser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name: goreleaser
33
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
jobs:
99
goreleaser:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
go-version: [ '1.20' ]
13+
go-version: ["1.23"]
1414

1515
steps:
1616
- name: Setup Golang ${{ matrix.go-version }}

.golangci.yml

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,34 @@
1+
version: "2"
2+
13
linters:
2-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
3-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
4-
disable-all: true
4+
default: none
5+
# This list of linters is not a recommendation (same thing for all this configuration file).
6+
# We intentionally use a limited set of linters.
7+
# See the comment on top of this file.
58
enable:
69
- bodyclose
7-
- deadcode
8-
- depguard
10+
- copyloopvar
911
- dogsled
1012
- dupl
1113
- errcheck
14+
- errorlint
1215
- funlen
16+
- gocheckcompilerdirectives
1317
- goconst
1418
- gocritic
1519
- gocyclo
16-
- gofmt
17-
- goimports
18-
- golint
20+
- godox
1921
- goprintffuncname
20-
- gosimple
2122
- govet
23+
- intrange
2224
- ineffassign
23-
- interfacer
2425
- misspell
26+
- noctx
2527
- nolintlint
26-
- rowserrcheck
27-
- scopelint
28+
- revive
2829
- staticcheck
29-
- structcheck
30-
- stylecheck
31-
- typecheck
30+
- testifylint
3231
- unconvert
3332
- unparam
3433
- unused
35-
- varcheck
3634
- whitespace
37-
38-
issues:
39-
# Excluding configuration per-path, per-linter, per-text and per-source
40-
exclude-rules:
41-
- path: _test\.go
42-
linters:
43-
- gomnd
44-
- linters:
45-
- stylecheck
46-
text: "ST1000:"
47-
# https://github.com/go-critic/go-critic/issues/926
48-
- linters:
49-
- gocritic
50-
text: "unnecessaryDefer:"
51-
52-
linters-settings:
53-
funlen:
54-
lines: 66
55-
statements: 40
56-

config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main provides a file watcher and auto-build tool for Go applications
12
package main
23

34
import (

example/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main provides a simple example of how to use gowatch
12
package main
23

34
import "fmt"

go.mod

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
module github.com/silenceper/gowatch
22

3-
go 1.24
3+
go 1.23
44

55
require (
6-
github.com/fsnotify/fsnotify v1.8.0
6+
github.com/fsnotify/fsnotify v1.9.0
77
github.com/mitchellh/go-ps v1.0.0
88
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a
99
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
1010
)
1111

1212
require (
13-
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
14-
golang.org/x/sys v0.31.0 // indirect
15-
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
13+
golang.org/x/sys v0.13.0 // indirect
14+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
1615
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
2-
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
1+
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
2+
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
3+
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
4+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
35
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
46
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
57
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
68
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
79
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
8-
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
9-
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
1010
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a h1:COf2KvPmardI1M8p2fhHsXlFS2EXSQygbGgcDYBI9Wc=
1111
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a/go.mod h1:nyN/YUSK3CgJjtNzm6dVTkcou+RYXNMP+XLSlzQu0m0=
12-
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
13-
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
14-
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
15-
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
13+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
14+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
15+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
1616
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
1717
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=

gowatch.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ func NewWatcher(paths []string, files []string) {
6565
Autobuild(files)
6666
}()
6767
}
68-
case err := <-watcher.Errors:
69-
log.Errorf("%v", err)
70-
log.Warnf(" %s\n", err.Error()) // No need to exit here
68+
case e := <-watcher.Errors:
69+
log.Errorf("%v", e)
70+
log.Warnf(" %s\n", e.Error()) // No need to exit here
7171
}
7272
}
7373
}()
@@ -91,6 +91,7 @@ func getFileModTime(path string) int64 {
9191
log.Errorf("Fail to open file[ %s ]\n", err)
9292
return time.Now().Unix()
9393
}
94+
//nolint:errcheck
9495
defer f.Close()
9596

9697
fi, err := f.Stat()
@@ -200,9 +201,9 @@ func Kill() {
200201
func killAllProcesses(pid int) (err error) {
201202
hasAllKilled := make(chan bool)
202203
go func() {
203-
pids, err := psTree(pid)
204-
if err != nil {
205-
log.Fatalf("getting all sub processes error: %v\n", err)
204+
pids, e := psTree(pid)
205+
if e != nil {
206+
log.Fatalf("getting all sub processes error: %v\n", e)
206207
return
207208
}
208209
log.Debugf("main pid: %d", pid)

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import "fmt"
44

5-
const version = "1.5.3"
5+
const version = "1.5.5"
66

77
func printVersion() {
88
fmt.Println(version)

0 commit comments

Comments
 (0)