Skip to content

Commit 37b1fe5

Browse files
authored
Merge pull request #237 from lbbniu/feat/lbbniu/golangci-lint
feat: 添加golangci-lint,并修复lint检查
2 parents 5c02636 + 7b96b31 commit 37b1fe5

53 files changed

Lines changed: 230 additions & 166 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/reviewdog.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: reviewdog
2+
on: [pull_request]
3+
jobs:
4+
golangci-lint:
5+
runs-on: ubuntu-latest
6+
name: runner / golangci-lint
7+
steps:
8+
- name: Check out code into the Go module directory
9+
uses: actions/checkout@v3
10+
- name: golangci-lint
11+
uses: reviewdog/action-golangci-lint@v2
12+
with:
13+
github_token: ${{ secrets.github_token }}
14+
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
15+
reporter: github-pr-review
16+
# Report all results.
17+
filter_mode: nofilter
18+
# Exit with 1 when it finds at least one finding.
19+
fail_on_error: true
20+
#golangci_lint_flags

.golangci.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
run:
2+
timeout: 30m
3+
skip-dirs:
4+
- examples
5+
6+
linters:
7+
disable-all: true
8+
enable:
9+
#- unused
10+
- ineffassign
11+
- goimports
12+
- gofmt
13+
- misspell
14+
- unparam
15+
- unconvert
16+
- govet
17+
# - errcheck
18+
- staticcheck
19+
20+
linters-settings:
21+
staticcheck:
22+
go: "1.16"
23+
checks:
24+
- "all"
25+
- "-SA1019"
26+
27+
unused:
28+
go: "1.16"

logo/zinxlogo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package logo
22

33
import (
44
"fmt"
5+
56
"github.com/aceld/zinx/zconf"
67
)
78

zasync_op/async_op_result.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@Author:14March
44
@File:async_op_result.go
55
*/
6+
67
package zasync_op
78

89
import (

zasync_op/async_worker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@Author:14March
44
@File:async_worker.go
55
*/
6+
67
package zasync_op
78

89
import "github.com/aceld/zinx/zlog"

zconf/globalobj.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ package zconf
88
import (
99
"encoding/json"
1010
"fmt"
11-
"github.com/aceld/zinx/zlog"
12-
"github.com/aceld/zinx/zutils/commandline/args"
13-
"github.com/aceld/zinx/zutils/commandline/uflag"
1411
"io/ioutil"
1512
"os"
1613
"reflect"
1714
"testing"
1815
"time"
16+
17+
"github.com/aceld/zinx/zlog"
18+
"github.com/aceld/zinx/zutils/commandline/args"
19+
"github.com/aceld/zinx/zutils/commandline/uflag"
1920
)
2021

2122
const (

zdecoder/crc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ var crc16_l = []byte{
6161
func GetCrC(buff []byte) []byte {
6262
var hi uint16 = 0x00ff
6363
var low uint16 = 0x00ff
64-
var pos uint16 = 0
6564

6665
for i := 0; i < len(buff); i++ {
67-
pos = (low ^ uint16(buff[i])) & 0x00ff
66+
pos := (low ^ uint16(buff[i])) & 0x00ff
6867
low = hi ^ uint16(crc16_h[pos])
6968
hi = uint16(crc16_l[pos])
7069
}

zdecoder/htlvcrcdecoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ package zdecoder
4444

4545
import (
4646
"encoding/hex"
47+
"math"
48+
4749
"github.com/aceld/zinx/ziface"
4850
"github.com/aceld/zinx/zlog"
49-
"math"
5051
)
5152

5253
const HEADER_SIZE = 5

zdecoder/ltvdecoder_little.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ package zdecoder
5151
import (
5252
"bytes"
5353
"encoding/binary"
54-
"github.com/aceld/zinx/ziface"
5554
"math"
55+
56+
"github.com/aceld/zinx/ziface"
5657
)
5758

5859
const LTV_HEADER_SIZE = 8 //表示TLV空包长度

zdecoder/tlvdecoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ package zdecoder
5252
import (
5353
"bytes"
5454
"encoding/binary"
55-
"github.com/aceld/zinx/ziface"
5655
"math"
56+
57+
"github.com/aceld/zinx/ziface"
5758
)
5859

5960
const TLV_HEADER_SIZE = 8 //表示TLV空包长度

0 commit comments

Comments
 (0)