fix: linter issue

megacheck, gosimple and unused has been deprecated and subsumed by
staticcheck. And staticcheck also has been upgraded. we need to update
code for the linter issue.

close: #2945

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu
2019-01-23 22:18:28 +08:00
parent 35582cb7a3
commit 132ee9b826
24 changed files with 42 additions and 61 deletions

View File

@@ -176,7 +176,7 @@ func (m *DB) Init(ctx context.Context) error {
if err := m.migrate(tx); err != nil {
return errors.Wrapf(err, "failed to migrate to %s.%d", m.schema, m.version)
}
log.G(ctx).WithField("d", time.Now().Sub(t0)).Debugf("finished database migration to %s.%d", m.schema, m.version)
log.G(ctx).WithField("d", time.Since(t0)).Debugf("finished database migration to %s.%d", m.schema, m.version)
}
}
@@ -328,7 +328,7 @@ func (m *DB) GarbageCollect(ctx context.Context) (gc.Stats, error) {
m.cleanupSnapshotter(snapshotterName)
sl.Lock()
stats.SnapshotD[snapshotterName] = time.Now().Sub(st1)
stats.SnapshotD[snapshotterName] = time.Since(st1)
sl.Unlock()
wg.Done()
@@ -343,7 +343,7 @@ func (m *DB) GarbageCollect(ctx context.Context) (gc.Stats, error) {
go func() {
ct1 := time.Now()
m.cleanupContent()
stats.ContentD = time.Now().Sub(ct1)
stats.ContentD = time.Since(ct1)
wg.Done()
}()
m.dirtyCS = false
@@ -351,7 +351,7 @@ func (m *DB) GarbageCollect(ctx context.Context) (gc.Stats, error) {
m.dirtyL.Unlock()
stats.MetaD = time.Now().Sub(t1)
stats.MetaD = time.Since(t1)
m.wlock.Unlock()
wg.Wait()