Skip to content

Commit

Permalink
br: Set check-static enable for br (pingcap#27642)
Browse files Browse the repository at this point in the history
  • Loading branch information
joccau authored Oct 27, 2021
1 parent 21a4a7e commit 8f192f0
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ header:
- '.gitignore'
- '.gitattributes'
- '.golangci.yml'
- '.golangci_br.yml'
- 'LICENSES/'
- '**/*.md'
- '**/*.json'
Expand Down
83 changes: 83 additions & 0 deletions .golangci_br.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
run:
concurrency: 4
timeout: 7m

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters:
enable-all: true
disable:
- gochecknoglobals
- gci
- wsl
- funlen
- gocognit
- godox
- gomnd
- testpackage
- nestif
- goerr113
- lll
- paralleltest
- nlreturn
- exhaustivestruct
- exhaustive
- godot
- gosec
- errorlint
- wrapcheck
- gomoddirectives
- bodyclose
- unused
- unparam
- wastedassign
- tagliatelle
- thelper
- nolintlint
- ineffassign
- nilerr
- noctx
- rowserrcheck
- predeclared
- ifshort
- cyclop
- whitespace
- unconvert
- forcetypeassert
- sqlclosecheck
- errcheck
- gocritic
- golint
- gocyclo
- promlinter
- forbidigo
- gochecknoinits
- scopelint
- revive
- misspell
- maligned
- makezero
- interfacer
- gofumpt
- goconst
- prealloc
- govet
- dupl
- deadcode
- varcheck
- nakedret

linters-settings:
staticcheck:
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
stylecheck:
checks: ["-ST1003"]
gosec:
excludes:
- G601

issues:
exclude-rules:
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ goword:tools/bin/goword
tools/bin/goword $(FILES) 2>&1 | $(FAIL_ON_STDOUT)

check-static: tools/bin/golangci-lint
tools/bin/golangci-lint run -v $$($(PACKAGE_DIRECTORIES_TIDB_TESTS))
GO111MODULE=on CGO_ENABLED=0 tools/bin/golangci-lint run -v $$($(PACKAGE_DIRECTORIES_TIDB_TESTS)) --config .golangci.yml
GO111MODULE=on CGO_ENABLED=0 tools/bin/golangci-lint run -v $$($(BR_PACKAGE_DIRECTORIES)) --config .golangci_br.yml

unconvert:tools/bin/unconvert
@echo "unconvert check(skip check the genenrated or copied code in lightning)"
Expand Down Expand Up @@ -386,4 +387,4 @@ dumpling_bins:
@which bin/tidb-server
@which bin/minio
@which bin/tidb-lightning
@which bin/sync_diff_inspector
@which bin/sync_diff_inspector
3 changes: 3 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ endif
ARCH := "`uname -s`"
LINUX := "Linux"
MAC := "Darwin"

PACKAGE_LIST := go list ./...
PACKAGE_LIST_TIDB_TESTS := go list ./... | grep -vE "github.com\/pingcap\/tidb\/br|github.com\/pingcap\/tidb\/cmd|github.com\/pingcap\/tidb\/dumpling"
PACKAGES ?= $$($(PACKAGE_LIST))
Expand All @@ -52,6 +53,7 @@ PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|github.com/pingcap/$(PROJECT)/||
PACKAGE_DIRECTORIES_TIDB_TESTS := $(PACKAGE_LIST_TIDB_TESTS) | sed 's|github.com/pingcap/$(PROJECT)/||'
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
FILES_TIDB_TESTS := $$(find $$($(PACKAGE_DIRECTORIES_TIDB_TESTS)) -name "*.go")

UNCONVERT_PACKAGES_LIST := go list ./...| grep -vE "lightning\/checkpoints|lightning\/manual|lightning\/common"
UNCONVERT_PACKAGES := $$($(UNCONVERT_PACKAGES_LIST))

Expand Down Expand Up @@ -88,6 +90,7 @@ endif

BR_PKG := github.com/pingcap/tidb/br
BR_PACKAGES := go list ./...| grep "github.com\/pingcap\/tidb\/br"
BR_PACKAGE_DIRECTORIES := $(BR_PACKAGES) | sed 's|github.com/pingcap/$(PROJECT)/||'
LIGHTNING_BIN := bin/tidb-lightning
LIGHTNING_CTL_BIN := bin/tidb-lightning-ctl
BR_BIN := bin/br
Expand Down
3 changes: 1 addition & 2 deletions br/pkg/lightning/backend/tidb/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,7 @@ func (be *tidbBackend) LocalWriter(
}

type Writer struct {
be *tidbBackend
errorMgr *errormanager.ErrorManager
be *tidbBackend
}

func (w *Writer) Close(ctx context.Context) (backend.ChunkFlushStatus, error) {
Expand Down

0 comments on commit 8f192f0

Please sign in to comment.