Skip to content

Commit c3eec7c

Browse files
bors[bot]xen0n
andauthored
Merge #51
51: Cleanups r=xen0n a=xen0n Co-authored-by: WANG Xuerui <wangxuerui@qiniu.com>
2 parents 807d871 + 7f87385 commit c3eec7c

File tree

15 files changed

+241
-24
lines changed

15 files changed

+241
-24
lines changed

.golangci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
run:
2+
timeout: 2m
3+
4+
linters:
5+
enable:
6+
# enabled by default
7+
# https://golangci-lint.run/usage/linters/
8+
- govet
9+
- errcheck
10+
- staticcheck
11+
- unused
12+
- gosimple
13+
- structcheck
14+
- varcheck
15+
- ineffassign
16+
- deadcode
17+
- typecheck
18+
# project additions
19+
# keep this list alphabetically sorted
20+
- bodyclose
21+
- goconst
22+
# - gofmt -- goimports contains this
23+
- goimports
24+
- gosec
25+
- misspell
26+
- nakedret
27+
- nolintlint
28+
- prealloc
29+
- unconvert
30+
31+
linters-settings:
32+
gofmt:
33+
simplify: true
34+
goimports:
35+
local-prefixes: github.com/xen0n/go-workwx
36+
misspell:
37+
locale: US
38+
nakedret:
39+
max-func-lines: 1

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: go
22
go:
3-
- "1.12.x"
43
- "1.13.x"
54
- "1.14.x"
5+
- "1.15.x"
66
go_import_path: github.com/xen0n/go-workwx
77
branches:
88
# https://bors.tech/documentation/getting-started/
@@ -18,9 +18,9 @@ cache:
1818
- $GOPATH/pkg/mod
1919
before_install:
2020
- export GO111MODULE=on
21-
- go get -u -v honnef.co/go/tools/cmd/staticcheck
21+
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0
22+
- ./ci/run-lint.sh
2223
install:
2324
- go install -v ./...
2425
script:
25-
- ./ci/run-lint.sh
2626
- go test -v ./...

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ in at least 2 of Qiniu's internal systems.
3636

3737
## Features
3838

39+
* 支持最近 3 个 Go 版本
3940
* 包名短
4041
* 支持覆盖 API `Host`,用于自己拦一层网关、临时调试等等奇葩需求
4142
* 支持使用自定义 `http.Client`

ci/run-lint.sh

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,5 @@ die() {
1212
}
1313

1414

15-
# gofmt conformance check
16-
check_gofmt() {
17-
# record the list of non-conforming source files
18-
local output="$(gofmt -s -l $@)"
19-
if [[ "x${output}" != "x" ]]; then
20-
# report the offending files then die
21-
die "the following files violate gofmt -s style: ${output}"
22-
fi
23-
}
24-
25-
# exclude vendored files
26-
# TODO: write this more elegantly
27-
check_gofmt *.go cmd
28-
29-
30-
# staticcheck for known problems
31-
staticcheck . || die "staticcheck reported error(s)"
15+
# golangci-lint for known problems
16+
golangci-lint run || die "staticcheck reported error(s)"

cmd/workwxctl/commands/cmd_send_message.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55

66
"github.com/urfave/cli/v2"
7+
78
"github.com/xen0n/go-workwx"
89
)
910

cmd/workwxctl/commands/cmd_upload_temp_media.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66

77
"github.com/urfave/cli/v2"
8+
89
"github.com/xen0n/go-workwx"
910
)
1011

cmd/workwxctl/commands/flags.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77

88
"github.com/urfave/cli/v2"
9+
910
"github.com/xen0n/go-workwx"
1011
)
1112

cmd/workwxctl/commands/tls_key_log_helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
// newTransportWithKeyLog initializes a HTTP Transport with KeyLogWriter
1414
func newTransportWithKeyLog(keyLog io.Writer) *http.Transport {
1515
transport := &http.Transport{
16+
//nolint: gosec // this transport is delibrately made to be a side channel
1617
TLSClientConfig: &tls.Config{KeyLogWriter: keyLog, InsecureSkipVerify: true},
1718

1819
// Copy of http.DefaultTransport

cmd/workwxctl/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ import (
88

99
func main() {
1010
app := commands.InitApp()
11-
app.Run(os.Args)
11+
// ignore errors
12+
_ = app.Run(os.Args)
1213
}

errcodes/mod.go

Lines changed: 182 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)