Skip to content

Commit 0a8ffad

Browse files
committed
adjust ci-lint
1 parent 9ab360e commit 0a8ffad

File tree

9 files changed

+13
-10
lines changed

9 files changed

+13
-10
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
- name: Set up Go
2525
uses: actions/setup-go@v3
2626
with:
27-
go-version: 1.19
27+
go-version: 1.20
2828
cache: true
2929

3030
- name: Lint Go Code
3131
run: |
3232
export PATH=$PATH:$(go env GOPATH)/bin
33-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49.0
33+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
3434
make ci-lint
3535
3636

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ linters:
4242
- goimports
4343
- gofmt
4444
- unused
45-
- depguard
45+
#- depguard
4646
- dogsled
4747
- errcheck
4848
#- gochecknoinits
@@ -153,9 +153,9 @@ linters-settings:
153153

154154
goconst:
155155
# minimal length of string constant, 3 by default
156-
min-len: 3
156+
min-len: 4
157157
# minimal occurrences count to trigger, 3 by default
158-
min-occurrences: 3
158+
min-occurrences: 4
159159

160160
gocyclo:
161161
# minimal code complexity to report, 30 by default (but we recommend 10-20)

cmd/protoc-gen-go-gin/internal/generate/handler/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func init() {
3030
panic(err)
3131
}
3232

33-
rand.Seed(time.Now().UnixNano())
33+
rand.Seed(time.Now().UnixNano()) //nolint
3434
}
3535

3636
var (

cmd/protoc-gen-go-gin/internal/generate/service/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121
panic(err)
2222
}
2323

24-
rand.Seed(time.Now().UnixNano())
24+
rand.Seed(time.Now().UnixNano()) //nolint
2525
}
2626

2727
var (

cmd/protoc-gen-go-rpc-tmpl/internal/generate/service/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121
panic(err)
2222
}
2323

24-
rand.Seed(time.Now().UnixNano())
24+
rand.Seed(time.Now().UnixNano()) //nolint
2525
}
2626

2727
var (

pkg/gotest/dao.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func (d *Dao) GetAnyArgs(obj interface{}) []driver.Value {
7878
to := reflect.TypeOf(obj)
7979
vo := reflect.ValueOf(obj)
8080

81+
//nolint
8182
if to.Kind() == reflect.Ptr {
8283
if vo.IsNil() {
8384
panic("nil ptr")

pkg/krand/krand.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
)
2121

2222
func init() {
23-
rand.Seed(time.Now().UnixNano())
23+
rand.Seed(time.Now().UnixNano()) //nolint
2424
}
2525

2626
// String generate random strings of any length of multiple types, default length is 6 if size is empty

pkg/servicerd/registry/etcd/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (r *Registry) heartBeat(ctx context.Context, leaseID clientv3.LeaseID, key
168168
if err != nil {
169169
curLeaseID = 0
170170
}
171-
rand.Seed(time.Now().Unix())
171+
rand.Seed(time.Now().Unix()) //nolint
172172

173173
for {
174174
if curLeaseID == 0 {

pkg/stat/stat.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func printUsageInfo() *statData {
125125
TotalAlloc: mProc.TotalAlloc,
126126
Sys: mProc.Sys,
127127
NumGc: mProc.NumGc,
128+
Goroutines: runtime.NumGoroutine(),
128129
}
129130

130131
zapLog.Info("statistics",
@@ -154,6 +155,7 @@ type process struct {
154155
TotalAlloc uint64 `json:"total_alloc"` // cumulative allocated memory capacity, unit(M)
155156
Sys uint64 `json:"sys"` // requesting memory capacity from the system, unit(M)
156157
NumGc uint32 `json:"num_gc"` // number of GC cycles
158+
Goroutines int `json:"goroutines"` // number of goroutines
157159
}
158160

159161
type statData struct {

0 commit comments

Comments
 (0)