Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Make unconvert linter happy and locking golangci-lint version #2172

Merged
merged 4 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- unconvert
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ tools/bin/errdoc-gen: tools/check/go.mod
cd tools/check; test -e ../bin/errdoc-gen || \
$(GO) build -o ../bin/errdoc-gen github.com/pingcap/errors/errdoc-gen

tools/bin/golangci-lint: tools/check/go.mod
tools/bin/golangci-lint:
cd tools/check; test -e ../bin/golangci-lint || \
$(GO) build -o ../bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ../bin v1.30.0

failpoint-enable: check_failpoint_ctl
$(FAILPOINT_ENABLE)
Expand Down
2 changes: 1 addition & 1 deletion cdc/model/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (info *ChangeFeedInfo) Unmarshal(data []byte) error {
return errors.Annotatef(
cerror.WrapError(cerror.ErrMarshalFailed, err), "Marshal data: %v", data)
}
info.Opts[mark.OptCyclicConfig] = string(cyclicCfg)
info.Opts[mark.OptCyclicConfig] = cyclicCfg
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions cdc/model/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,19 +314,19 @@ func ColumnValueString(c interface{}) string {
case int32:
data = strconv.FormatInt(int64(v), 10)
case int64:
data = strconv.FormatInt(int64(v), 10)
data = strconv.FormatInt(v, 10)
case uint8:
data = strconv.FormatUint(uint64(v), 10)
case uint16:
data = strconv.FormatUint(uint64(v), 10)
case uint32:
data = strconv.FormatUint(uint64(v), 10)
case uint64:
data = strconv.FormatUint(uint64(v), 10)
data = strconv.FormatUint(v, 10)
case float32:
data = strconv.FormatFloat(float64(v), 'f', -1, 32)
case float64:
data = strconv.FormatFloat(float64(v), 'f', -1, 64)
data = strconv.FormatFloat(v, 'f', -1, 64)
case string:
data = v
case []byte:
Expand Down
2 changes: 1 addition & 1 deletion cdc/owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const (
// CDCServiceSafePointID is the ID of CDC service in pd.UpdateServiceGCSafePoint.
CDCServiceSafePointID = "ticdc"
// GCSafepointUpdateInterval is the minimual interval that CDC can update gc safepoint
GCSafepointUpdateInterval = time.Duration(2 * time.Second)
GCSafepointUpdateInterval = 2 * time.Second
// MinGCSafePointCacheUpdateInterval is the interval that update minGCSafePointCache
MinGCSafePointCacheUpdateInterval = time.Second * 2
)
Expand Down
2 changes: 1 addition & 1 deletion cdc/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (p *processor) lazyInitImpl(ctx cdcContext.Context) error {
if err != nil {
return errors.Trace(err)
}
opts[mark.OptCyclicConfig] = string(cyclicCfg)
opts[mark.OptCyclicConfig] = cyclicCfg
}
opts[sink.OptChangefeedID] = p.changefeed.ID
opts[sink.OptCaptureAddr] = ctx.GlobalVars().CaptureInfo.AdvertiseAddr
Expand Down
2 changes: 1 addition & 1 deletion cdc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (s *Server) etcdHealthChecker(ctx context.Context) error {
case <-ticker.C:
for _, pdEndpoint := range s.pdEndpoints {
start := time.Now()
ctx, cancel := context.WithTimeout(ctx, time.Duration(time.Second*10))
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
req, err := http.NewRequestWithContext(
ctx, http.MethodGet, fmt.Sprintf("%s/health", pdEndpoint), nil)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cdc/sink/codec/craft/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (d *termDictionary) encodeNullable(s *string) int64 {
if s == nil {
return nullInt64
}
return int64(d.encode(*s))
return d.encode(*s)
}

func (d *termDictionary) encode(s string) int64 {
Expand Down Expand Up @@ -424,7 +424,7 @@ func newRowChangedMessage(allocator *SliceAllocator, ev *model.RowChangedEvent)
groups[idx] = group
estimatedSize += size
}
return estimatedSize, rowChangedEvent(groups)
return estimatedSize, groups
}

// RowChangedEventBuffer is a buffer to save row changed events in batch
Expand Down
4 changes: 2 additions & 2 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ func verifyTables(ctx context.Context, credential *security.Credential, cfg *con
}

for tID, tableName := range snap.CloneTables() {
tableInfo, exist := snap.TableByID(int64(tID))
tableInfo, exist := snap.TableByID(tID)
if !exist {
return nil, nil, errors.NotFoundf("table %d", int64(tID))
return nil, nil, errors.NotFoundf("table %d", tID)
}
if filter.ShouldIgnoreTable(tableName.Schema, tableName.Table) {
continue
Expand Down
1 change: 0 additions & 1 deletion tools/check/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/pingcap/tidb-cdc/_tools
go 1.16

require (
github.com/golangci/golangci-lint v1.33.0
github.com/mgechev/revive v1.0.2
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3
mvdan.cc/gofumpt v0.0.0-20201123090407-3077abae40c0
Expand Down
579 changes: 24 additions & 555 deletions tools/check/go.sum

Large diffs are not rendered by default.