ci: add golint (#212)

This commit is contained in:
disksing 2021-07-05 11:02:07 +08:00 committed by GitHub
parent 014ba36a4d
commit 54f5ebdc7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 13 deletions

View File

@ -7,6 +7,7 @@ linters:
- exportloopref - exportloopref
- gofmt - gofmt
- goimports - goimports
- golint
- goprintffuncname - goprintffuncname
- gosimple - gosimple
- govet - govet
@ -21,3 +22,7 @@ linters:
- unconvert - unconvert
- unused - unused
- varcheck - varcheck
issues:
include:
- EXC0002 # disable excluding of issues about comments from golint

View File

@ -62,6 +62,7 @@ func NewBufferBatchGetter(buffer BatchBufferGetter, snapshot BatchGetter) *Buffe
return &BufferBatchGetter{buffer: buffer, snapshot: snapshot} return &BufferBatchGetter{buffer: buffer, snapshot: snapshot}
} }
// BatchGet gets a batch of values.
func (b *BufferBatchGetter) BatchGet(ctx context.Context, keys [][]byte) (map[string][]byte, error) { func (b *BufferBatchGetter) BatchGet(ctx context.Context, keys [][]byte) (map[string][]byte, error) {
if b.buffer.Len() == 0 { if b.buffer.Len() == 0 {
return b.snapshot.BatchGet(ctx, keys) return b.snapshot.BatchGet(ctx, keys)

View File

@ -28,19 +28,19 @@ import (
zap "go.uber.org/zap" zap "go.uber.org/zap"
) )
/// GC does garbage collection (GC) of the TiKV cluster. // GC does garbage collection (GC) of the TiKV cluster.
/// GC deletes MVCC records whose timestamp is lower than the given `safepoint`. We must guarantee // GC deletes MVCC records whose timestamp is lower than the given `safepoint`. We must guarantee
/// that all transactions started before this timestamp had committed. We can keep an active // that all transactions started before this timestamp had committed. We can keep an active
/// transaction list in application to decide which is the minimal start timestamp of them. // transaction list in application to decide which is the minimal start timestamp of them.
/// //
/// For each key, the last mutation record (unless it's a deletion) before `safepoint` is retained. // For each key, the last mutation record (unless it's a deletion) before `safepoint` is retained.
/// //
/// GC is performed by: // GC is performed by:
/// 1. resolving all locks with timestamp <= `safepoint` // 1. resolving all locks with timestamp <= `safepoint`
/// 2. updating PD's known safepoint // 2. updating PD's known safepoint
/// //
/// This is a simplified version of [GC in TiDB](https://docs.pingcap.com/tidb/stable/garbage-collection-overview). // GC is a simplified version of [GC in TiDB](https://docs.pingcap.com/tidb/stable/garbage-collection-overview).
/// We skip the second step "delete ranges" which is an optimization for TiDB. // We skip the second step "delete ranges" which is an optimization for TiDB.
func (s *KVStore) GC(ctx context.Context, safepoint uint64) (newSafePoint uint64, err error) { func (s *KVStore) GC(ctx context.Context, safepoint uint64) (newSafePoint uint64, err error) {
err = s.resolveLocks(ctx, safepoint, 8) err = s.resolveLocks(ctx, safepoint, 8)
if err != nil { if err != nil {