Repository: dragonflyoss/Dragonfly2
Pull request #244 (2021-05-21 08:36:28)

Fix lint
<!--- Provide a general summary of your changes in the Title above -->

## Description
- Fix lint.
<!--- Describe your changes in detail -->

## Related Issue
#241 
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation Update (if none of the other choices apply)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] Code compiles correctly.
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.



Patch:
diff --git a/cdnsystem/cdnerrors/errors.go b/cdnsystem/cdnerrors/errors.go
index 49d55e8a..cd073354 100644
--- a/cdnsystem/cdnerrors/errors.go
+++ b/cdnsystem/cdnerrors/errors.go
@@ -27,25 +27,25 @@ var (
 	// ErrURLNotReachable represents the url is a not reachable.
 	ErrURLNotReachable = errors.New("url not reachable")
 
-	// ErrTaskIdDuplicate represents the task id is in conflict.
-	ErrTaskIdDuplicate = errors.New("taskId conflict")
+	// ErrTaskIDDuplicate represents the task id is in conflict.
+	ErrTaskIDDuplicate = errors.New("taskId conflict")
 
-	// ErrPieceCountNotEqual
+	// ErrPieceCountNotEqual represents piece count is not equal.
 	ErrPieceCountNotEqual = errors.New("inconsistent number of pieces")
 
-	// ErrFileLengthNotEqual
+	// ErrFileLengthNotEqual represents file length is not equal.
 	ErrFileLengthNotEqual = errors.New("inconsistent file length")
 
-	// ErrDownloadFail
+	// ErrDownloadFail represents download failed.
 	ErrDownloadFail = errors.New("resource download failed")
 
-	// ErrResourceExpired
+	// ErrResourceExpired represents resource is expired.
 	ErrResourceExpired = errors.New("resource expired")
 
-	// ErrResourceNotSupportRangeRequest
+	// ErrResourceNotSupportRangeRequest represents resource is not support range.
 	ErrResourceNotSupportRangeRequest = errors.New("resource does not support range request")
 
-	// ErrPieceMd5NotMatch
+	// ErrPieceMd5NotMatch represents piece md5 is not match.
 	ErrPieceMd5NotMatch = errors.New("piece md5 check fail")
 
 	// ErrDataNotFound represents the data cannot be found.
@@ -76,7 +76,7 @@ func IsURLNotReachable(err error) bool {
 
 // IsTaskIDDuplicate checks the error is a TaskIDDuplicate error or not.
 func IsTaskIDDuplicate(err error) bool {
-	return errors.Cause(err) == ErrTaskIdDuplicate
+	return errors.Cause(err) == ErrTaskIDDuplicate
 }
 
 func IsPieceCountNotEqual(err error) bool {
diff --git a/cdnsystem/cdnutil/cdn_util.go b/cdnsystem/cdnutil/cdn_util.go
index 98bfb31b..7c8f32ef 100644
--- a/cdnsystem/cdnutil/cdn_util.go
+++ b/cdnsystem/cdnutil/cdn_util.go
@@ -22,6 +22,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
 )
 
-func GenCdnPeerId(taskId string) string {
-	return fmt.Sprintf("%s-%s_%s", iputils.HostName, taskId, "CDN")
+func GenCDNPeerID(taskID string) string {
+	return fmt.Sprintf("%s-%s_%s", iputils.HostName, taskID, "CDN")
 }
diff --git a/cdnsystem/config/config.go b/cdnsystem/config/config.go
index 5436f12b..828e9675 100644
--- a/cdnsystem/config/config.go
+++ b/cdnsystem/config/config.go
@@ -110,7 +110,7 @@ func NewDefaultBaseProperties() *BaseProperties {
 		GCStorageInterval:       DefaultGCStorageInterval,
 		TaskExpireTime:          DefaultTaskExpireTime,
 		StoragePattern:          DefaultStoragePattern,
-		AdvertiseIP:             iputils.HostIp,
+		AdvertiseIP:             iputils.HostIP,
 	}
 }
 
diff --git a/cdnsystem/config/constants.go b/cdnsystem/config/constants.go
index 5b2f569d..7831f7f6 100644
--- a/cdnsystem/config/constants.go
+++ b/cdnsystem/config/constants.go
@@ -72,4 +72,4 @@ const (
 	// DefaultMaxBandwidth is the default network bandwidth that cdn can use.
 	// unit: MB/s
 	DefaultMaxBandwidth = 1 * unit.GB
-)
\ No newline at end of file
+)
diff --git a/cdnsystem/daemon/mgr/cdn/cache_data_mgr.go b/cdnsystem/daemon/mgr/cdn/cache_data_mgr.go
index 7735acba..83f38e1e 100644
--- a/cdnsystem/daemon/mgr/cdn/cache_data_mgr.go
+++ b/cdnsystem/daemon/mgr/cdn/cache_data_mgr.go
@@ -68,11 +68,11 @@ func (mm *cacheDataManager) writeFileMetaDataByTask(ctx context.Context, task *t
 }
 
 // updateAccessTime update access and interval
-func (mm *cacheDataManager) updateAccessTime(ctx context.Context, taskId string, accessTime int64) error {
-	mm.cacheLocker.Lock(taskId, false)
-	defer mm.cacheLocker.UnLock(taskId, false)
+func (mm *cacheDataManager) updateAccessTime(ctx context.Context, taskID string, accessTime int64) error {
+	mm.cacheLocker.Lock(taskID, false)
+	defer mm.cacheLocker.UnLock(taskID, false)
 
-	originMetaData, err := mm.readFileMetaData(ctx, taskId)
+	originMetaData, err := mm.readFileMetaData(ctx, taskID)
 	if err != nil {
 		return err
 	}
@@ -80,34 +80,34 @@ func (mm *cacheDataManager) updateAccessTime(ctx context.Context, taskId string,
 	interval := accessTime - originMetaData.AccessTime
 	originMetaData.Interval = interval
 	if interval <= 0 {
-		logger.WithTaskID(taskId).Warnf("file hit interval:%d, accessTime:%d", interval, time.Unix(accessTime/1000, accessTime%1000))
+		logger.WithTaskID(taskID).Warnf("file hit interval:%d, accessTime:%v", interval, time.Unix(accessTime/1000, accessTime%1000))
 		originMetaData.Interval = 0
 	}
 
 	originMetaData.AccessTime = accessTime
 
-	return mm.storage.WriteFileMetaData(ctx, taskId, originMetaData)
+	return mm.storage.WriteFileMetaData(ctx, taskID, originMetaData)
 }
 
-func (mm *cacheDataManager) updateExpireInfo(ctx context.Context, taskId string, expireInfo map[string]string) error {
-	mm.cacheLocker.Lock(taskId, false)
-	defer mm.cacheLocker.UnLock(taskId, false)
+func (mm *cacheDataManager) updateExpireInfo(ctx context.Context, taskID string, expireInfo map[string]string) error {
+	mm.cacheLocker.Lock(taskID, false)
+	defer mm.cacheLocker.UnLock(taskID, false)
 
-	originMetaData, err := mm.readFileMetaData(ctx, taskId)
+	originMetaData, err := mm.readFileMetaData(ctx, taskID)
 	if err != nil {
 		return err
 	}
 
 	originMetaData.ExpireInfo = expireInfo
 
-	return mm.storage.WriteFileMetaData(ctx, taskId, originMetaData)
+	return mm.storage.WriteFileMetaData(ctx, taskID, originMetaData)
 }
 
-func (mm *cacheDataManager) updateStatusAndResult(ctx context.Context, taskId string, metaData *storage.FileMetaData) error {
-	mm.cacheLocker.Lock(taskId, false)
-	defer mm.cacheLocker.UnLock(taskId, false)
+func (mm *cacheDataManager) updateStatusAndResult(ctx context.Context, taskID string, metaData *storage.FileMetaData) error {
+	mm.cacheLocker.Lock(taskID, false)
+	defer mm.cacheLocker.UnLock(taskID, false)
 
-	originMetaData, err := mm.readFileMetaData(ctx, taskId)
+	originMetaData, err := mm.readFileMetaData(ctx, taskID)
 	if err != nil {
 		return err
 	}
@@ -127,30 +127,30 @@ func (mm *cacheDataManager) updateStatusAndResult(ctx context.Context, taskId st
 			originMetaData.PieceMd5Sign = metaData.PieceMd5Sign
 		}
 	}
-	return mm.storage.WriteFileMetaData(ctx, taskId, originMetaData)
+	return mm.storage.WriteFileMetaData(ctx, taskID, originMetaData)
 }
 
 // appendPieceMetaData append piece meta info to storage
-func (mm *cacheDataManager) appendPieceMetaData(ctx context.Context, taskId string, record *storage.PieceMetaRecord) error {
-	mm.cacheLocker.Lock(taskId, false)
-	defer mm.cacheLocker.UnLock(taskId, false)
+func (mm *cacheDataManager) appendPieceMetaData(ctx context.Context, taskID string, record *storage.PieceMetaRecord) error {
+	mm.cacheLocker.Lock(taskID, false)
+	defer mm.cacheLocker.UnLock(taskID, false)
 	// write to the storage
-	return mm.storage.AppendPieceMetaData(ctx, taskId, record)
+	return mm.storage.AppendPieceMetaData(ctx, taskID, record)
 }
 
 // appendPieceMetaData append piece meta info to storage
-func (mm *cacheDataManager) writePieceMetaRecords(ctx context.Context, taskId string, records []*storage.PieceMetaRecord) error {
-	mm.cacheLocker.Lock(taskId, false)
-	defer mm.cacheLocker.UnLock(taskId, false)
+func (mm *cacheDataManager) writePieceMetaRecords(ctx context.Context, taskID string, records []*storage.PieceMetaRecord) error {
+	mm.cacheLocker.Lock(taskID, false)
+	defer mm.cacheLocker.UnLock(taskID, false)
 	// write to the storage
-	return mm.storage.WritePieceMetaRecords(ctx, taskId, records)
+	return mm.storage.WritePieceMetaRecords(ctx, taskID, records)
 }
 
 // readAndCheckPieceMetaRecords reads pieceMetaRecords from storage and check data integrity by the md5 file of the TaskId
-func (mm *cacheDataManager) readAndCheckPieceMetaRecords(ctx context.Context, taskId, pieceMd5Sign string) ([]*storage.PieceMetaRecord, error) {
-	mm.cacheLocker.Lock(taskId, true)
-	defer mm.cacheLocker.UnLock(taskId, true)
-	md5Sign, pieceMetaRecords, err := mm.getPieceMd5Sign(ctx, taskId)
+func (mm *cacheDataManager) readAndCheckPieceMetaRecords(ctx context.Context, taskID, pieceMd5Sign string) ([]*storage.PieceMetaRecord, error) {
+	mm.cacheLocker.Lock(taskID, true)
+	defer mm.cacheLocker.UnLock(taskID, true)
+	md5Sign, pieceMetaRecords, err := mm.getPieceMd5Sign(ctx, taskID)
 	if err != nil {
 		return nil, err
 	}
@@ -162,14 +162,14 @@ func (mm *cacheDataManager) readAndCheckPieceMetaRecords(ctx context.Context, ta
 }
 
 // readPieceMetaRecords reads pieceMetaRecords from storage and without check data integrity
-func (mm *cacheDataManager) readPieceMetaRecords(ctx context.Context, taskId string) ([]*storage.PieceMetaRecord, error) {
-	mm.cacheLocker.Lock(taskId, true)
-	defer mm.cacheLocker.UnLock(taskId, true)
-	return mm.storage.ReadPieceMetaRecords(ctx, taskId)
+func (mm *cacheDataManager) readPieceMetaRecords(ctx context.Context, taskID string) ([]*storage.PieceMetaRecord, error) {
+	mm.cacheLocker.Lock(taskID, true)
+	defer mm.cacheLocker.UnLock(taskID, true)
+	return mm.storage.ReadPieceMetaRecords(ctx, taskID)
 }
 
-func (mm *cacheDataManager) getPieceMd5Sign(ctx context.Context, taskId string) (string, []*storage.PieceMetaRecord, error) {
-	pieceMetaRecords, err := mm.storage.ReadPieceMetaRecords(ctx, taskId)
+func (mm *cacheDataManager) getPieceMd5Sign(ctx context.Context, taskID string) (string, []*storage.PieceMetaRecord, error) {
+	pieceMetaRecords, err := mm.storage.ReadPieceMetaRecords(ctx, taskID)
 	if err != nil {
 		return "", nil, errors.Wrapf(err, "failed to read piece meta file")
 	}
@@ -180,20 +180,20 @@ func (mm *cacheDataManager) getPieceMd5Sign(ctx context.Context, taskId string)
 	return digestutils.Sha256(pieceMd5...), pieceMetaRecords, nil
 }
 
-func (mm *cacheDataManager) readFileMetaData(ctx context.Context, taskId string) (*storage.FileMetaData, error) {
-	if fileMeta, err := mm.storage.ReadFileMetaData(ctx, taskId); err != nil {
+func (mm *cacheDataManager) readFileMetaData(ctx context.Context, taskID string) (*storage.FileMetaData, error) {
+	fileMeta, err := mm.storage.ReadFileMetaData(ctx, taskID)
+	if err != nil {
 		return nil, errors.Wrapf(err, "failed to read file metadata from storage")
-	} else {
-		return fileMeta, nil
 	}
+	return fileMeta, nil
 }
 
-func (mm *cacheDataManager) statDownloadFile(ctx context.Context, taskId string) (*storedriver.StorageInfo, error) {
-	return mm.storage.StatDownloadFile(ctx, taskId)
+func (mm *cacheDataManager) statDownloadFile(ctx context.Context, taskID string) (*storedriver.StorageInfo, error) {
+	return mm.storage.StatDownloadFile(ctx, taskID)
 }
 
-func (mm *cacheDataManager) readDownloadFile(ctx context.Context, taskId string) (io.ReadCloser, error) {
-	return mm.storage.ReadDownloadFile(ctx, taskId)
+func (mm *cacheDataManager) readDownloadFile(ctx context.Context, taskID string) (io.ReadCloser, error) {
+	return mm.storage.ReadDownloadFile(ctx, taskID)
 }
 
 func (mm *cacheDataManager) resetRepo(ctx context.Context, task *types.SeedTask) error {
@@ -202,6 +202,6 @@ func (mm *cacheDataManager) resetRepo(ctx context.Context, task *types.SeedTask)
 	return mm.storage.ResetRepo(ctx, task)
 }
 
-func (mm *cacheDataManager) writeDownloadFile(ctx context.Context, taskId string, offset int64, len int64, buf *bytes.Buffer) error {
-	return mm.storage.WriteDownloadFile(ctx, taskId, offset, len, buf)
+func (mm *cacheDataManager) writeDownloadFile(ctx context.Context, taskID string, offset int64, len int64, buf *bytes.Buffer) error {
+	return mm.storage.WriteDownloadFile(ctx, taskID, offset, len, buf)
 }
diff --git a/cdnsystem/daemon/mgr/cdn/cache_detector.go b/cdnsystem/daemon/mgr/cdn/cache_detector.go
index 55a581fd..aa0599e3 100644
--- a/cdnsystem/daemon/mgr/cdn/cache_detector.go
+++ b/cdnsystem/daemon/mgr/cdn/cache_detector.go
@@ -74,10 +74,9 @@ func (cd *cacheDetector) detectCache(ctx context.Context, task *types.SeedTask)
 			return result, nil
 		}
 		return result, err
-	} else {
-		if err := cd.cacheDataManager.updateAccessTime(ctx, task.TaskId, getCurrentTimeMillisFunc()); err != nil {
-			logger.WithTaskID(task.TaskId).Warnf("failed to update task access time ")
-		}
+	}
+	if err := cd.cacheDataManager.updateAccessTime(ctx, task.TaskId, getCurrentTimeMillisFunc()); err != nil {
+		logger.WithTaskID(task.TaskId).Warnf("failed to update task access time ")
 	}
 	return result, nil
 }
@@ -119,12 +118,12 @@ func (cd *cacheDetector) doDetect(ctx context.Context, task *types.SeedTask) (re
 }
 
 // parseByReadMetaFile detect cache by read meta and pieceMeta files of task
-func (cd *cacheDetector) parseByReadMetaFile(ctx context.Context, taskId string,
+func (cd *cacheDetector) parseByReadMetaFile(ctx context.Context, taskID string,
 	fileMetaData *storage.FileMetaData) (*cacheResult, error) {
 	if !fileMetaData.Success {
 		return nil, errors.Wrapf(cdnerrors.ErrDownloadFail, "success flag of download is false")
 	}
-	pieceMetaRecords, err := cd.cacheDataManager.readAndCheckPieceMetaRecords(ctx, taskId, fileMetaData.PieceMd5Sign)
+	pieceMetaRecords, err := cd.cacheDataManager.readAndCheckPieceMetaRecords(ctx, taskID, fileMetaData.PieceMd5Sign)
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to check piece meta integrity")
 	}
@@ -132,7 +131,7 @@ func (cd *cacheDetector) parseByReadMetaFile(ctx context.Context, taskId string,
 		return nil, errors.Wrapf(cdnerrors.ErrPieceCountNotEqual, "piece file piece count(%d), "+
 			"meta file piece count(%d)", len(pieceMetaRecords), fileMetaData.TotalPieceCount)
 	}
-	storageInfo, err := cd.cacheDataManager.statDownloadFile(ctx, taskId)
+	storageInfo, err := cd.cacheDataManager.statDownloadFile(ctx, taskID)
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to get cdn file length")
 	}
@@ -150,13 +149,13 @@ func (cd *cacheDetector) parseByReadMetaFile(ctx context.Context, taskId string,
 }
 
 // parseByReadFile detect cache by read pieceMeta and data files of task
-func (cd *cacheDetector) parseByReadFile(ctx context.Context, taskId string, metaData *storage.FileMetaData) (*cacheResult, error) {
-	reader, err := cd.cacheDataManager.readDownloadFile(ctx, taskId)
+func (cd *cacheDetector) parseByReadFile(ctx context.Context, taskID string, metaData *storage.FileMetaData) (*cacheResult, error) {
+	reader, err := cd.cacheDataManager.readDownloadFile(ctx, taskID)
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to read data file")
 	}
 	defer reader.Close()
-	tempRecords, err := cd.cacheDataManager.readPieceMetaRecords(ctx, taskId)
+	tempRecords, err := cd.cacheDataManager.readPieceMetaRecords(ctx, taskID)
 	if err != nil {
 		return nil, errors.Wrapf(err, "parseByReadFile:failed to read piece meta file")
 	}
@@ -175,14 +174,14 @@ func (cd *cacheDetector) parseByReadFile(ctx context.Context, taskId string, met
 		}
 		// read content
 		if err := checkPieceContent(reader, tempRecords[index], fileMd5); err != nil {
-			logger.WithTaskID(taskId).Errorf("read content of pieceNum %d failed: %v", tempRecords[index].PieceNum, err)
+			logger.WithTaskID(taskID).Errorf("read content of pieceNum %d failed: %v", tempRecords[index].PieceNum, err)
 			break
 		}
 		breakPoint = tempRecords[index].OriginRange.EndIndex + 1
 		pieceMetaRecords = append(pieceMetaRecords, tempRecords[index])
 	}
 	if len(tempRecords) != len(pieceMetaRecords) {
-		if err := cd.cacheDataManager.writePieceMetaRecords(ctx, taskId, pieceMetaRecords); err != nil {
+		if err := cd.cacheDataManager.writePieceMetaRecords(ctx, taskID, pieceMetaRecords); err != nil {
 			return nil, errors.Wrapf(err, "write piece meta records failed")
 		}
 	}
diff --git a/cdnsystem/daemon/mgr/cdn/cache_detector_util.go b/cdnsystem/daemon/mgr/cdn/cache_detector_util.go
index 534b8666..591c97d2 100644
--- a/cdnsystem/daemon/mgr/cdn/cache_detector_util.go
+++ b/cdnsystem/daemon/mgr/cdn/cache_detector_util.go
@@ -61,7 +61,7 @@ func checkSameFile(task *types.SeedTask, metaData *storage.FileMetaData) error {
 func checkPieceContent(reader io.Reader, pieceRecord *storage.PieceMetaRecord, fileMd5 hash.Hash) error {
 	bufSize := int32(256 * 1024)
 	pieceLen := pieceRecord.PieceLen
-	if pieceLen >0 && pieceLen < bufSize {
+	if pieceLen > 0 && pieceLen < bufSize {
 		bufSize = pieceLen
 	}
 	// todo 针对分片格式解析出原始数据来计算fileMd5
@@ -113,4 +113,4 @@ func checkPieceContent(reader io.Reader, pieceRecord *storage.PieceMetaRecord, f
 			realPieceMd5, pieceRecord.Md5)
 	}
 	return nil
-}
\ No newline at end of file
+}
diff --git a/cdnsystem/daemon/mgr/cdn/cache_writer_util.go b/cdnsystem/daemon/mgr/cdn/cache_writer_util.go
index 6dbf6dab..7c47a01b 100644
--- a/cdnsystem/daemon/mgr/cdn/cache_writer_util.go
+++ b/cdnsystem/daemon/mgr/cdn/cache_writer_util.go
@@ -66,7 +66,7 @@ func (cw *cacheWriter) writerPool(ctx context.Context, wg *sync.WaitGroup, write
 				waitToWriteContent := job.pieceContent
 				// 要写盘数据的长度
 				originPieceLen := waitToWriteContent.Len() // 未作处理的原始数据长度
-				pieceLen := originPieceLen // 经过处理后写到存储介质的真实长度
+				pieceLen := originPieceLen                 // 经过处理后写到存储介质的真实长度
 				pieceStyle := types.PlainUnspecified
 
 				if err := cw.writeToFile(ctx, job.TaskId, waitToWriteContent, int64(job.pieceNum)*int64(job.pieceSize), pieceMd5); err != nil {
@@ -114,7 +114,7 @@ func (cw *cacheWriter) writerPool(ctx context.Context, wg *sync.WaitGroup, write
 }
 
 // writeToFile
-func (cw *cacheWriter) writeToFile(ctx context.Context, taskId string, bytesBuffer *bytes.Buffer, offset int64, pieceMd5 hash.Hash) error {
+func (cw *cacheWriter) writeToFile(ctx context.Context, taskID string, bytesBuffer *bytes.Buffer, offset int64, pieceMd5 hash.Hash) error {
 	var resultBuf = &bytes.Buffer{}
 	// write piece content
 	var pieceContent []byte
@@ -135,5 +135,5 @@ func (cw *cacheWriter) writeToFile(ctx context.Context, taskId string, bytesBuff
 		}
 	}
 	// write to the storage
-	return cw.cacheDataManager.writeDownloadFile(ctx, taskId, offset, int64(pieceContLen), resultBuf)
+	return cw.cacheDataManager.writeDownloadFile(ctx, taskID, offset, int64(pieceContLen), resultBuf)
 }
diff --git a/cdnsystem/daemon/mgr/cdn/downloader.go b/cdnsystem/daemon/mgr/cdn/downloader.go
index cec64e63..afeeeb2f 100644
--- a/cdnsystem/daemon/mgr/cdn/downloader.go
+++ b/cdnsystem/daemon/mgr/cdn/downloader.go
@@ -29,7 +29,6 @@ import (
 
 const RangeHeaderName = "Range"
 
-
 func (cm *Manager) download(task *types.SeedTask, detectResult *cacheResult) (io.ReadCloser, map[string]string, error) {
 	headers := maputils.DeepCopyMap(nil, task.Header)
 	if detectResult.breakPoint > 0 {
@@ -45,4 +44,4 @@ func (cm *Manager) download(task *types.SeedTask, detectResult *cacheResult) (io
 	logger.WithTaskID(task.TaskId).Infof("start download url %s at range:%d-%d: with header: %+v", task.Url, detectResult.breakPoint,
 		task.SourceFileLength, task.Header)
 	return cm.resourceClient.Download(task.Url, headers)
-}
\ No newline at end of file
+}
diff --git a/cdnsystem/daemon/mgr/cdn/manager.go b/cdnsystem/daemon/mgr/cdn/manager.go
index 847ac5d0..ca29de28 100644
--- a/cdnsystem/daemon/mgr/cdn/manager.go
+++ b/cdnsystem/daemon/mgr/cdn/manager.go
@@ -138,8 +138,8 @@ func (cm *Manager) TriggerCDN(ctx context.Context, task *types.SeedTask) (seedTa
 		downloadMetadata.realSourceFileLength, downloadMetadata.realCdnFileLength), nil
 }
 
-func (cm *Manager) Delete(ctx context.Context, TaskId string) error {
-	err := cm.cacheStore.DeleteTask(ctx, TaskId)
+func (cm *Manager) Delete(ctx context.Context, taskID string) error {
+	err := cm.cacheStore.DeleteTask(ctx, taskID)
 	if err != nil {
 		return errors.Wrap(err, "failed to delete task files")
 	}
@@ -198,9 +198,9 @@ func (cm *Manager) handleCDNResult(ctx context.Context, task *types.SeedTask, so
 	return true, nil
 }
 
-func (cm *Manager) updateExpireInfo(ctx context.Context, TaskId string, expireInfo map[string]string) {
-	if err := cm.cacheDataManager.updateExpireInfo(ctx, TaskId, expireInfo); err != nil {
-		logger.WithTaskID(TaskId).Errorf("failed to update expireInfo(%s): %v", expireInfo, err)
+func (cm *Manager) updateExpireInfo(ctx context.Context, taskID string, expireInfo map[string]string) {
+	if err := cm.cacheDataManager.updateExpireInfo(ctx, taskID, expireInfo); err != nil {
+		logger.WithTaskID(taskID).Errorf("failed to update expireInfo(%s): %v", expireInfo, err)
 	}
-	logger.WithTaskID(TaskId).Infof("success to update expireInfo(%s)", expireInfo)
+	logger.WithTaskID(taskID).Infof("success to update expireInfo(%s)", expireInfo)
 }
diff --git a/cdnsystem/daemon/mgr/cdn/reporter.go b/cdnsystem/daemon/mgr/cdn/reporter.go
index b613bbf7..3191d2ed 100644
--- a/cdnsystem/daemon/mgr/cdn/reporter.go
+++ b/cdnsystem/daemon/mgr/cdn/reporter.go
@@ -44,11 +44,11 @@ func newReporter(publisher mgr.SeedProgressMgr, cacheStore storage.Manager) *rep
 }
 
 // report cache result
-func (re *reporter) reportCache(ctx context.Context, taskId string, detectResult *cacheResult) error {
+func (re *reporter) reportCache(ctx context.Context, taskID string, detectResult *cacheResult) error {
 	// report cache pieces status
 	if detectResult != nil && detectResult.pieceMetaRecords != nil {
 		for _, record := range detectResult.pieceMetaRecords {
-			if err := re.reportPieceMetaRecord(ctx, taskId, record, CacheReport); err != nil {
+			if err := re.reportPieceMetaRecord(ctx, taskID, record, CacheReport); err != nil {
 				return errors.Wrapf(err, "failed to publish pieceMetaRecord:%v, seedPiece:%v", record,
 					convertPieceMeta2SeedPiece(record))
 			}
@@ -58,12 +58,12 @@ func (re *reporter) reportCache(ctx context.Context, taskId string, detectResult
 }
 
 // reportPieceMetaRecord
-func (re *reporter) reportPieceMetaRecord(ctx context.Context, taskId string, record *storage.PieceMetaRecord,
+func (re *reporter) reportPieceMetaRecord(ctx context.Context, taskID string, record *storage.PieceMetaRecord,
 	from string) error {
 	// report cache pieces status
-	logger.DownloaderLogger.Info(taskId,
+	logger.DownloaderLogger.Info(taskID,
 		zap.Int32("pieceNum", record.PieceNum),
 		zap.String("md5", record.Md5),
 		zap.String("from", from))
-	return re.progress.PublishPiece(ctx, taskId, convertPieceMeta2SeedPiece(record))
+	return re.progress.PublishPiece(ctx, taskID, convertPieceMeta2SeedPiece(record))
 }
diff --git a/cdnsystem/daemon/mgr/cdn/storage/disk/disk.go b/cdnsystem/daemon/mgr/cdn/storage/disk/disk.go
index 2f35a4a0..64fd0a6a 100644
--- a/cdnsystem/daemon/mgr/cdn/storage/disk/disk.go
+++ b/cdnsystem/daemon/mgr/cdn/storage/disk/disk.go
@@ -107,12 +107,12 @@ func (s *diskStorageMgr) InitializeCleaners() {
 	}
 }
 
-func (s *diskStorageMgr) AppendPieceMetaData(ctx context.Context, taskId string, pieceRecord *storage.PieceMetaRecord) error {
-	return s.diskStore.PutBytes(ctx, storage.GetAppendPieceMetaDataRaw(taskId), []byte(pieceRecord.String()+"\n"))
+func (s *diskStorageMgr) AppendPieceMetaData(ctx context.Context, taskID string, pieceRecord *storage.PieceMetaRecord) error {
+	return s.diskStore.PutBytes(ctx, storage.GetAppendPieceMetaDataRaw(taskID), []byte(pieceRecord.String()+"\n"))
 }
 
-func (s *diskStorageMgr) ReadPieceMetaRecords(ctx context.Context, taskId string) ([]*storage.PieceMetaRecord, error) {
-	bytes, err := s.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskId))
+func (s *diskStorageMgr) ReadPieceMetaRecords(ctx context.Context, taskID string) ([]*storage.PieceMetaRecord, error) {
+	bytes, err := s.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskID))
 	if err != nil {
 		return nil, err
 	}
@@ -132,7 +132,7 @@ func (s *diskStorageMgr) GC(ctx context.Context) error {
 	logger.GcLogger.With("type", "disk").Info("start the disk storage gc job")
 	gcTaskIDs, err := s.diskStoreCleaner.Gc(ctx, "disk", false)
 	if err != nil {
-		logger.GcLogger.With("type", "disk").Error("failed to get gcTaskIds")
+		logger.GcLogger.With("type", "disk").Error("failed to get gcTaskIDs")
 	}
 	var realGCCount int
 	for _, taskID := range gcTaskIDs {
@@ -161,15 +161,15 @@ func (s *diskStorageMgr) SetTaskMgr(mgr mgr.SeedTaskMgr) {
 	s.taskMgr = mgr
 }
 
-func (s *diskStorageMgr) WriteDownloadFile(ctx context.Context, taskId string, offset int64, len int64, buf *bytes.Buffer) error {
-	raw := storage.GetDownloadRaw(taskId)
+func (s *diskStorageMgr) WriteDownloadFile(ctx context.Context, taskID string, offset int64, len int64, buf *bytes.Buffer) error {
+	raw := storage.GetDownloadRaw(taskID)
 	raw.Offset = offset
 	raw.Length = len
 	return s.diskStore.Put(ctx, raw, buf)
 }
 
-func (s *diskStorageMgr) ReadFileMetaData(ctx context.Context, taskId string) (*storage.FileMetaData, error) {
-	bytes, err := s.diskStore.GetBytes(ctx, storage.GetTaskMetaDataRaw(taskId))
+func (s *diskStorageMgr) ReadFileMetaData(ctx context.Context, taskID string) (*storage.FileMetaData, error) {
+	bytes, err := s.diskStore.GetBytes(ctx, storage.GetTaskMetaDataRaw(taskID))
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to get metadata bytes")
 	}
@@ -181,63 +181,63 @@ func (s *diskStorageMgr) ReadFileMetaData(ctx context.Context, taskId string) (*
 	return metaData, nil
 }
 
-func (s *diskStorageMgr) WriteFileMetaData(ctx context.Context, taskId string, metaData *storage.FileMetaData) error {
+func (s *diskStorageMgr) WriteFileMetaData(ctx context.Context, taskID string, metaData *storage.FileMetaData) error {
 	data, err := json.Marshal(metaData)
 	if err != nil {
 		return errors.Wrapf(err, "failed to marshal metadata")
 	}
-	return s.diskStore.PutBytes(ctx, storage.GetTaskMetaDataRaw(taskId), data)
+	return s.diskStore.PutBytes(ctx, storage.GetTaskMetaDataRaw(taskID), data)
 }
 
-func (s *diskStorageMgr) WritePieceMetaRecords(ctx context.Context, taskId string, records []*storage.PieceMetaRecord) error {
+func (s *diskStorageMgr) WritePieceMetaRecords(ctx context.Context, taskID string, records []*storage.PieceMetaRecord) error {
 	recordStrs := make([]string, 0, len(records))
 	for i := range records {
 		recordStrs = append(recordStrs, records[i].String())
 	}
-	pieceRaw := storage.GetPieceMetaDataRaw(taskId)
+	pieceRaw := storage.GetPieceMetaDataRaw(taskID)
 	pieceRaw.Trunc = true
 	pieceRaw.TruncSize = 0
 	return s.diskStore.PutBytes(ctx, pieceRaw, []byte(strings.Join(recordStrs, "\n")))
 }
 
-func (s *diskStorageMgr) ReadPieceMetaBytes(ctx context.Context, taskId string) ([]byte, error) {
-	return s.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskId))
+func (s *diskStorageMgr) ReadPieceMetaBytes(ctx context.Context, taskID string) ([]byte, error) {
+	return s.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskID))
 }
 
-func (s *diskStorageMgr) ReadDownloadFile(ctx context.Context, taskId string) (io.ReadCloser, error) {
-	return s.diskStore.Get(ctx, storage.GetDownloadRaw(taskId))
+func (s *diskStorageMgr) ReadDownloadFile(ctx context.Context, taskID string) (io.ReadCloser, error) {
+	return s.diskStore.Get(ctx, storage.GetDownloadRaw(taskID))
 }
 
-func (s *diskStorageMgr) StatDownloadFile(ctx context.Context, taskId string) (*storedriver.StorageInfo, error) {
-	return s.diskStore.Stat(ctx, storage.GetDownloadRaw(taskId))
+func (s *diskStorageMgr) StatDownloadFile(ctx context.Context, taskID string) (*storedriver.StorageInfo, error) {
+	return s.diskStore.Stat(ctx, storage.GetDownloadRaw(taskID))
 }
 
-func (s *diskStorageMgr) CreateUploadLink(ctx context.Context, taskId string) error {
+func (s *diskStorageMgr) CreateUploadLink(ctx context.Context, taskID string) error {
 	// create a soft link from the upload file to the download file
-	if err := fileutils.SymbolicLink(s.diskStore.GetPath(storage.GetDownloadRaw(taskId)),
-		s.diskStore.GetPath(storage.GetUploadRaw(taskId))); err != nil {
+	if err := fileutils.SymbolicLink(s.diskStore.GetPath(storage.GetDownloadRaw(taskID)),
+		s.diskStore.GetPath(storage.GetUploadRaw(taskID))); err != nil {
 		return err
 	}
 	return nil
 }
 
-func (s *diskStorageMgr) DeleteTask(ctx context.Context, taskId string) error {
-	if err := s.diskStore.Remove(ctx, storage.GetTaskMetaDataRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+func (s *diskStorageMgr) DeleteTask(ctx context.Context, taskID string) error {
+	if err := s.diskStore.Remove(ctx, storage.GetTaskMetaDataRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		errors.Cause(err)
 		return err
 	}
-	if err := s.diskStore.Remove(ctx, storage.GetPieceMetaDataRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+	if err := s.diskStore.Remove(ctx, storage.GetPieceMetaDataRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		return err
 	}
-	if err := s.diskStore.Remove(ctx, storage.GetDownloadRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+	if err := s.diskStore.Remove(ctx, storage.GetDownloadRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		return err
 	}
-	if err := s.diskStore.Remove(ctx, storage.GetUploadRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+	if err := s.diskStore.Remove(ctx, storage.GetUploadRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		return err
 	}
 	// try to clean the parent bucket
-	if err := s.diskStore.Remove(ctx, storage.GetParentRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
-		logrus.Warnf("taskID:%s failed remove parent bucket:%v", taskId, err)
+	if err := s.diskStore.Remove(ctx, storage.GetParentRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
+		logrus.Warnf("taskID:%s failed remove parent bucket:%v", taskID, err)
 	}
 	return nil
 }
diff --git a/cdnsystem/daemon/mgr/cdn/storage/hybrid/hybrid.go b/cdnsystem/daemon/mgr/cdn/storage/hybrid/hybrid.go
index 6c5acd8a..ac67ddca 100644
--- a/cdnsystem/daemon/mgr/cdn/storage/hybrid/hybrid.go
+++ b/cdnsystem/daemon/mgr/cdn/storage/hybrid/hybrid.go
@@ -175,24 +175,24 @@ func (h *hybridStorageMgr) InitializeCleaners() {
 	logger.GcLogger.With("type", "hybrid").Info("success initialize hybrid cleaners")
 }
 
-func (h *hybridStorageMgr) WriteDownloadFile(ctx context.Context, taskId string, offset int64, len int64,
+func (h *hybridStorageMgr) WriteDownloadFile(ctx context.Context, taskID string, offset int64, len int64,
 	buf *bytes.Buffer) error {
-	raw := storage.GetDownloadRaw(taskId)
+	raw := storage.GetDownloadRaw(taskID)
 	raw.Offset = offset
 	raw.Length = len
 	return h.diskStore.Put(ctx, raw, buf)
 }
 
-func (h *hybridStorageMgr) DeleteTask(ctx context.Context, taskId string) error {
-	return h.deleteTaskFiles(ctx, taskId, true, true)
+func (h *hybridStorageMgr) DeleteTask(ctx context.Context, taskID string) error {
+	return h.deleteTaskFiles(ctx, taskID, true, true)
 }
 
-func (h *hybridStorageMgr) ReadDownloadFile(ctx context.Context, taskId string) (io.ReadCloser, error) {
-	return h.diskStore.Get(ctx, storage.GetDownloadRaw(taskId))
+func (h *hybridStorageMgr) ReadDownloadFile(ctx context.Context, taskID string) (io.ReadCloser, error) {
+	return h.diskStore.Get(ctx, storage.GetDownloadRaw(taskID))
 }
 
-func (h *hybridStorageMgr) ReadPieceMetaRecords(ctx context.Context, taskId string) ([]*storage.PieceMetaRecord, error) {
-	bytes, err := h.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskId))
+func (h *hybridStorageMgr) ReadPieceMetaRecords(ctx context.Context, taskID string) ([]*storage.PieceMetaRecord, error) {
+	bytes, err := h.diskStore.GetBytes(ctx, storage.GetPieceMetaDataRaw(taskID))
 	if err != nil {
 		return nil, err
 	}
@@ -208,8 +208,8 @@ func (h *hybridStorageMgr) ReadPieceMetaRecords(ctx context.Context, taskId stri
 	return result, nil
 }
 
-func (h *hybridStorageMgr) ReadFileMetaData(ctx context.Context, taskId string) (*storage.FileMetaData, error) {
-	bytes, err := h.diskStore.GetBytes(ctx, storage.GetTaskMetaDataRaw(taskId))
+func (h *hybridStorageMgr) ReadFileMetaData(ctx context.Context, taskID string) (*storage.FileMetaData, error) {
+	bytes, err := h.diskStore.GetBytes(ctx, storage.GetTaskMetaDataRaw(taskID))
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to get metadata bytes")
 	}
@@ -221,30 +221,30 @@ func (h *hybridStorageMgr) ReadFileMetaData(ctx context.Context, taskId string)
 	return metaData, nil
 }
 
-func (h *hybridStorageMgr) AppendPieceMetaData(ctx context.Context, taskId string, record *storage.PieceMetaRecord) error {
-	return h.diskStore.PutBytes(ctx, storage.GetAppendPieceMetaDataRaw(taskId), []byte(record.String()+"\n"))
+func (h *hybridStorageMgr) AppendPieceMetaData(ctx context.Context, taskID string, record *storage.PieceMetaRecord) error {
+	return h.diskStore.PutBytes(ctx, storage.GetAppendPieceMetaDataRaw(taskID), []byte(record.String()+"\n"))
 }
 
-func (h *hybridStorageMgr) WriteFileMetaData(ctx context.Context, taskId string, metaData *storage.FileMetaData) error {
+func (h *hybridStorageMgr) WriteFileMetaData(ctx context.Context, taskID string, metaData *storage.FileMetaData) error {
 	data, err := json.Marshal(metaData)
 	if err != nil {
 		return errors.Wrapf(err, "failed to marshal metadata")
 	}
-	return h.diskStore.PutBytes(ctx, storage.GetTaskMetaDataRaw(taskId), data)
+	return h.diskStore.PutBytes(ctx, storage.GetTaskMetaDataRaw(taskID), data)
 }
 
-func (h *hybridStorageMgr) WritePieceMetaRecords(ctx context.Context, taskId string, records []*storage.PieceMetaRecord) error {
+func (h *hybridStorageMgr) WritePieceMetaRecords(ctx context.Context, taskID string, records []*storage.PieceMetaRecord) error {
 	recordStrs := make([]string, 0, len(records))
 	for i := range records {
 		recordStrs = append(recordStrs, records[i].String())
 	}
-	return h.diskStore.PutBytes(ctx, storage.GetPieceMetaDataRaw(taskId), []byte(strings.Join(recordStrs, "\n")))
+	return h.diskStore.PutBytes(ctx, storage.GetPieceMetaDataRaw(taskID), []byte(strings.Join(recordStrs, "\n")))
 }
 
-func (h *hybridStorageMgr) CreateUploadLink(ctx context.Context, taskId string) error {
+func (h *hybridStorageMgr) CreateUploadLink(ctx context.Context, taskID string) error {
 	// create a soft link from the upload file to the download file
-	if err := fileutils.SymbolicLink(h.diskStore.GetPath(storage.GetDownloadRaw(taskId)),
-		h.diskStore.GetPath(storage.GetUploadRaw(taskId))); err != nil {
+	if err := fileutils.SymbolicLink(h.diskStore.GetPath(storage.GetDownloadRaw(taskID)),
+		h.diskStore.GetPath(storage.GetUploadRaw(taskID))); err != nil {
 		return err
 	}
 	return nil
@@ -266,66 +266,66 @@ func (h *hybridStorageMgr) GetDownloadPath(rawFunc *storedriver.Raw) string {
 	return h.diskStore.GetPath(rawFunc)
 }
 
-func (h *hybridStorageMgr) StatDownloadFile(ctx context.Context, taskId string) (*storedriver.StorageInfo, error) {
-	return h.diskStore.Stat(ctx, storage.GetDownloadRaw(taskId))
+func (h *hybridStorageMgr) StatDownloadFile(ctx context.Context, taskID string) (*storedriver.StorageInfo, error) {
+	return h.diskStore.Stat(ctx, storage.GetDownloadRaw(taskID))
 }
 
-func (h *hybridStorageMgr) deleteDiskFiles(ctx context.Context, taskId string) error {
-	return h.deleteTaskFiles(ctx, taskId, true, true)
+func (h *hybridStorageMgr) deleteDiskFiles(ctx context.Context, taskID string) error {
+	return h.deleteTaskFiles(ctx, taskID, true, true)
 }
 
-func (h *hybridStorageMgr) deleteMemoryFiles(ctx context.Context, taskId string) error {
-	return h.deleteTaskFiles(ctx, taskId, true, false)
+func (h *hybridStorageMgr) deleteMemoryFiles(ctx context.Context, taskID string) error {
+	return h.deleteTaskFiles(ctx, taskID, true, false)
 }
 
-func (h *hybridStorageMgr) deleteTaskFiles(ctx context.Context, taskId string, deleteUploadPath bool, deleteHardLink bool) error {
+func (h *hybridStorageMgr) deleteTaskFiles(ctx context.Context, taskID string, deleteUploadPath bool, deleteHardLink bool) error {
 	// delete task file data
-	if err := h.diskStore.Remove(ctx, storage.GetDownloadRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+	if err := h.diskStore.Remove(ctx, storage.GetDownloadRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		return err
 	}
 	// delete memory file
-	if err := h.memoryStore.Remove(ctx, storage.GetDownloadRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+	if err := h.memoryStore.Remove(ctx, storage.GetDownloadRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 		return err
 	}
 
 	if deleteUploadPath {
-		if err := h.diskStore.Remove(ctx, storage.GetUploadRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+		if err := h.diskStore.Remove(ctx, storage.GetUploadRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 			return err
 		}
 	}
-	exists := h.diskStore.Exits(ctx, getHardLinkRaw(taskId))
+	exists := h.diskStore.Exits(ctx, getHardLinkRaw(taskID))
 	if !deleteHardLink && exists {
-		h.diskStore.MoveFile(h.diskStore.GetPath(getHardLinkRaw(taskId)), h.diskStore.GetPath(storage.GetDownloadRaw(
-			taskId)))
+		h.diskStore.MoveFile(h.diskStore.GetPath(getHardLinkRaw(taskID)), h.diskStore.GetPath(storage.GetDownloadRaw(
+			taskID)))
 	} else {
-		if err := h.diskStore.Remove(ctx, getHardLinkRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+		if err := h.diskStore.Remove(ctx, getHardLinkRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 			return err
 		}
-		// deleteTaskFiles delete files associated with taskId
-		if err := h.diskStore.Remove(ctx, storage.GetTaskMetaDataRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+		// deleteTaskFiles delete files associated with taskID
+		if err := h.diskStore.Remove(ctx, storage.GetTaskMetaDataRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 			return err
 		}
 		// delete piece meta data
-		if err := h.diskStore.Remove(ctx, storage.GetPieceMetaDataRaw(taskId)); err != nil && !cdnerrors.IsFileNotExist(err) {
+		if err := h.diskStore.Remove(ctx, storage.GetPieceMetaDataRaw(taskID)); err != nil && !cdnerrors.IsFileNotExist(err) {
 			return err
 		}
 	}
 	// try to clean the parent bucket
-	if err := h.diskStore.Remove(ctx, storage.GetParentRaw(taskId)); err != nil &&
+	if err := h.diskStore.Remove(ctx, storage.GetParentRaw(taskID)); err != nil &&
 		!cdnerrors.IsFileNotExist(err) {
-		logger.WithTaskID(taskId).Warnf("failed to remove parent bucket:%v", err)
+		logger.WithTaskID(taskID).Warnf("failed to remove parent bucket:%v", err)
 	}
 	return nil
 }
 
-func (h *hybridStorageMgr) tryShmSpace(ctx context.Context, url, taskId string, fileLength int64) (string, error) {
+func (h *hybridStorageMgr) tryShmSpace(ctx context.Context, url, taskID string, fileLength int64) (string, error) {
 	if h.shmSwitch.check(url, fileLength) && h.hasShm {
 		remainder := atomic.NewInt64(0)
 		h.memoryStore.Walk(ctx, &storedriver.Raw{
 			WalkFn: func(filePath string, info os.FileInfo, err error) error {
 				if fileutils.IsRegular(filePath) {
-					taskId := path.Base(filePath)
-					task, err := h.taskMgr.Get(ctx, taskId)
+					taskID := path.Base(filePath)
+					task, err := h.taskMgr.Get(ctx, taskID)
 					if err == nil {
 						var totalLen int64 = 0
 						if task.CdnFileLength > 0 {
@@ -337,7 +337,7 @@ func (h *hybridStorageMgr) tryShmSpace(ctx context.Context, url, taskId string,
 							remainder.Add(totalLen - info.Size())
 						}
 					} else {
-						logger.Warnf("failed to get task:%s: %v", taskId, err)
+						logger.Warnf("failed to get task:%s: %v", taskID, err)
 					}
 				}
 				return nil
@@ -353,7 +353,7 @@ func (h *hybridStorageMgr) tryShmSpace(ctx context.Context, url, taskId string,
 		}
 		if canUseShm { // 创建shm
 			raw := &storedriver.Raw{
-				Key: taskId,
+				Key: taskID,
 			}
 			return h.memoryStore.GetPath(raw), nil
 		}
@@ -420,8 +420,8 @@ func (h *hybridStorageMgr) getMemoryUsableSpace(ctx context.Context) unit.Bytes
 	return 0
 }
 
-func getHardLinkRaw(taskId string) *storedriver.Raw {
-	raw := storage.GetDownloadRaw(taskId)
+func getHardLinkRaw(taskID string) *storedriver.Raw {
+	raw := storage.GetDownloadRaw(taskID)
 	raw.Key = raw.Key + ".hard"
 	return raw
 }
diff --git a/cdnsystem/daemon/mgr/cdn/storage/path_util.go b/cdnsystem/daemon/mgr/cdn/storage/path_util.go
index feab8f93..4e302ff3 100644
--- a/cdnsystem/daemon/mgr/cdn/storage/path_util.go
+++ b/cdnsystem/daemon/mgr/cdn/storage/path_util.go
@@ -31,63 +31,63 @@ const (
 	UploadHome = "upload"
 )
 
-func getDownloadKey(taskId string) string {
-	return path.Join(getParentKey(taskId), taskId)
+func getDownloadKey(taskID string) string {
+	return path.Join(getParentKey(taskID), taskID)
 }
 
-func getTaskMetaDataKey(taskId string) string {
-	return path.Join(getParentKey(taskId), taskId+".meta")
+func getTaskMetaDataKey(taskID string) string {
+	return path.Join(getParentKey(taskID), taskID+".meta")
 }
 
-func getPieceMetaDataKey(TaskId string) string {
-	return path.Join(getParentKey(TaskId), TaskId+".piece")
+func getPieceMetaDataKey(taskID string) string {
+	return path.Join(getParentKey(taskID), taskID+".piece")
 }
 
-func getParentKey(taskId string) string {
-	return stringutils.SubString(taskId, 0, 3)
+func getParentKey(taskID string) string {
+	return stringutils.SubString(taskID, 0, 3)
 }
 
-func GetDownloadRaw(taskId string) *storedriver.Raw {
+func GetDownloadRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: DownloadHome,
-		Key:    getDownloadKey(taskId),
+		Key:    getDownloadKey(taskID),
 	}
 }
 
-func GetUploadRaw(taskId string) *storedriver.Raw {
+func GetUploadRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: UploadHome,
-		Key:    getDownloadKey(taskId),
+		Key:    getDownloadKey(taskID),
 	}
 }
 
-func GetTaskMetaDataRaw(taskId string) *storedriver.Raw {
+func GetTaskMetaDataRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: DownloadHome,
-		Key:    getTaskMetaDataKey(taskId),
+		Key:    getTaskMetaDataKey(taskID),
 		Trunc:  true,
 	}
 }
 
-func GetPieceMetaDataRaw(taskId string) *storedriver.Raw {
+func GetPieceMetaDataRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: DownloadHome,
-		Key:    getPieceMetaDataKey(taskId),
+		Key:    getPieceMetaDataKey(taskID),
 	}
 }
 
-func GetAppendPieceMetaDataRaw(taskId string) *storedriver.Raw {
+func GetAppendPieceMetaDataRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: DownloadHome,
-		Key:    getPieceMetaDataKey(taskId),
+		Key:    getPieceMetaDataKey(taskID),
 		Append: true,
 	}
 }
 
-func GetParentRaw(taskId string) *storedriver.Raw {
+func GetParentRaw(taskID string) *storedriver.Raw {
 	return &storedriver.Raw{
 		Bucket: DownloadHome,
-		Key:    getParentKey(taskId),
+		Key:    getParentKey(taskID),
 	}
 }
 
diff --git a/cdnsystem/daemon/mgr/cdn/storage/storage_gc.go b/cdnsystem/daemon/mgr/cdn/storage/storage_gc.go
index c72679f9..5d93921d 100644
--- a/cdnsystem/daemon/mgr/cdn/storage/storage_gc.go
+++ b/cdnsystem/daemon/mgr/cdn/storage/storage_gc.go
@@ -25,7 +25,7 @@ import (
 	"d7y.io/dragonfly/v2/cdnsystem/cdnerrors"
 	"d7y.io/dragonfly/v2/cdnsystem/daemon/mgr"
 	"d7y.io/dragonfly/v2/cdnsystem/storedriver"
-	"d7y.io/dragonfly/v2/pkg/dflog"
+	logger "d7y.io/dragonfly/v2/pkg/dflog"
 	"d7y.io/dragonfly/v2/pkg/util/timeutils"
 	"github.com/emirpasic/gods/maps/treemap"
 	godsutils "github.com/emirpasic/gods/utils"
@@ -56,7 +56,7 @@ func (cleaner *Cleaner) Gc(ctx context.Context, storagePattern string, force boo
 			if err != nil {
 				return nil, err
 			}
-			freeSpace, err = cleaner.Store.GetAvailSpace(ctx)
+			freeSpace, _ = cleaner.Store.GetAvailSpace(ctx)
 		} else {
 			return nil, errors.Wrapf(err, "failed to get avail space")
 		}
@@ -90,31 +90,31 @@ func (cleaner *Cleaner) Gc(ctx context.Context, storagePattern string, force boo
 		if info.IsDir() {
 			return nil
 		}
-		taskId := strings.Split(info.Name(), ".")[0]
-		// If the taskId has been handled, and no need to do that again.
-		if walkTaskIds[taskId] {
+		taskID := strings.Split(info.Name(), ".")[0]
+		// If the taskID has been handled, and no need to do that again.
+		if walkTaskIds[taskID] {
 			return nil
 		}
-		walkTaskIds[taskId] = true
+		walkTaskIds[taskID] = true
 
 		// we should return directly when we success to get info which means it is being used
-		if _, err := cleaner.TaskMgr.Get(ctx, taskId); err == nil || !cdnerrors.IsDataNotFound(err) {
+		if _, err := cleaner.TaskMgr.Get(ctx, taskID); err == nil || !cdnerrors.IsDataNotFound(err) {
 			if err != nil {
-				logger.GcLogger.With("type", storagePattern).Errorf("failed to get taskId(%s): %v", taskId, err)
+				logger.GcLogger.With("type", storagePattern).Errorf("failed to get taskID(%s): %v", taskID, err)
 			}
 			return nil
 		}
 
-		// add taskId to gcTaskIds slice directly when fullGC equals true.
+		// add taskID to gcTaskIds slice directly when fullGC equals true.
 		if fullGC {
-			gcTaskIDs = append(gcTaskIDs, taskId)
+			gcTaskIDs = append(gcTaskIDs, taskID)
 			return nil
 		}
 
-		metaData, err := cleaner.StorageMgr.ReadFileMetaData(ctx, taskId)
+		metaData, err := cleaner.StorageMgr.ReadFileMetaData(ctx, taskID)
 		if err != nil || metaData == nil {
-			logger.GcLogger.With("type", storagePattern).Debugf("taskId: %s, failed to get metadata: %v", taskId, err)
-			gcTaskIDs = append(gcTaskIDs, taskId)
+			logger.GcLogger.With("type", storagePattern).Debugf("taskID: %s, failed to get metadata: %v", taskID, err)
+			gcTaskIDs = append(gcTaskIDs, taskID)
 			return nil
 		}
 		// put taskId into gapTasks or intervalTasks which will sort by some rules
@@ -173,14 +173,14 @@ func (cleaner *Cleaner) getGCTasks(gapTasks, intervalTasks *treemap.Map) []strin
 	var gcTasks = make([]string, 0)
 
 	for _, v := range gapTasks.Values() {
-		if taskIds, ok := v.([]string); ok {
-			gcTasks = append(gcTasks, taskIds...)
+		if taskIDs, ok := v.([]string); ok {
+			gcTasks = append(gcTasks, taskIDs...)
 		}
 	}
 
 	for _, v := range intervalTasks.Values() {
-		if taskIds, ok := v.([]string); ok {
-			gcTasks = append(gcTasks, taskIds...)
+		if taskIDs, ok := v.([]string); ok {
+			gcTasks = append(gcTasks, taskIDs...)
 		}
 	}
 
diff --git a/cdnsystem/daemon/mgr/cdn/storage/storage_mgr.go b/cdnsystem/daemon/mgr/cdn/storage/storage_mgr.go
index 45598043..4d6757a3 100644
--- a/cdnsystem/daemon/mgr/cdn/storage/storage_mgr.go
+++ b/cdnsystem/daemon/mgr/cdn/storage/storage_mgr.go
@@ -149,27 +149,27 @@ func NewManager(cfg *config.Config) (Manager, error) {
 }
 
 type Manager interface {
-	ResetRepo(ctx context.Context, task *types.SeedTask) error
+	ResetRepo(context.Context, *types.SeedTask) error
 
-	StatDownloadFile(ctx context.Context, taskId string) (*storedriver.StorageInfo, error)
+	StatDownloadFile(context.Context, string) (*storedriver.StorageInfo, error)
 
-	WriteDownloadFile(ctx context.Context, taskId string, offset int64, len int64, buf *bytes.Buffer) error
+	WriteDownloadFile(context.Context, string, int64, int64, *bytes.Buffer) error
 
-	ReadDownloadFile(ctx context.Context, taskId string) (io.ReadCloser, error)
+	ReadDownloadFile(context.Context, string) (io.ReadCloser, error)
 
-	CreateUploadLink(ctx context.Context, taskId string) error
+	CreateUploadLink(context.Context, string) error
 
-	ReadFileMetaData(ctx context.Context, taskId string) (*FileMetaData, error)
+	ReadFileMetaData(context.Context, string) (*FileMetaData, error)
 
-	WriteFileMetaData(ctx context.Context, taskId string, data *FileMetaData) error
+	WriteFileMetaData(context.Context, string, *FileMetaData) error
 
-	WritePieceMetaRecords(ctx context.Context, id string, records []*PieceMetaRecord) error
+	WritePieceMetaRecords(context.Context, string, []*PieceMetaRecord) error
 
-	AppendPieceMetaData(ctx context.Context, taskId string, pieceRecord *PieceMetaRecord) error
+	AppendPieceMetaData(context.Context, string, *PieceMetaRecord) error
 
-	ReadPieceMetaRecords(ctx context.Context, taskId string) ([]*PieceMetaRecord, error)
+	ReadPieceMetaRecords(context.Context, string) ([]*PieceMetaRecord, error)
 
-	DeleteTask(ctx context.Context, taskId string) error
+	DeleteTask(context.Context, string) error
 
 	SetTaskMgr(mgr.SeedTaskMgr)
 
diff --git a/cdnsystem/daemon/mgr/cdn_mgr.go b/cdnsystem/daemon/mgr/cdn_mgr.go
index 3638fe6d..d4d49b78 100644
--- a/cdnsystem/daemon/mgr/cdn_mgr.go
+++ b/cdnsystem/daemon/mgr/cdn_mgr.go
@@ -22,15 +22,14 @@ import (
 	"d7y.io/dragonfly/v2/cdnsystem/types"
 )
 
-
 // CDNMgr as an interface defines all operations against CDN and
 // operates on the underlying files stored on the local disk, etc.
 type CDNMgr interface {
 
 	// TriggerCDN will trigger CDN to download the resource from sourceUrl.
-	TriggerCDN(ctx context.Context, taskInfo *types.SeedTask) (*types.SeedTask, error)
+	TriggerCDN(context.Context, *types.SeedTask) (*types.SeedTask, error)
 
 	// Delete the cdn meta with specified taskID.
 	// The file on the disk will be deleted when the force is true.
-	Delete(ctx context.Context, taskID string) error
+	Delete(context.Context, string) error
 }
diff --git a/cdnsystem/daemon/mgr/gc/manager.go b/cdnsystem/daemon/mgr/gc/manager.go
index 516f0a1d..cce8b2d5 100644
--- a/cdnsystem/daemon/mgr/gc/manager.go
+++ b/cdnsystem/daemon/mgr/gc/manager.go
@@ -61,7 +61,7 @@ type Manager struct {
 	cdnMgr  mgr.CDNMgr
 }
 
-func (gcm *Manager) GCTask(ctx context.Context, taskID string, full bool) error{
+func (gcm *Manager) GCTask(ctx context.Context, taskID string, full bool) error {
 	// todo data consistency
 	var err error
 	if full {
diff --git a/cdnsystem/daemon/mgr/progress/manager.go b/cdnsystem/daemon/mgr/progress/manager.go
index a881d406..63b57981 100644
--- a/cdnsystem/daemon/mgr/progress/manager.go
+++ b/cdnsystem/daemon/mgr/progress/manager.go
@@ -63,38 +63,38 @@ func NewManager(cfg *config.Config) (*Manager, error) {
 	}, nil
 }
 
-func (pm *Manager) InitSeedProgress(ctx context.Context, taskId string) {
-	pm.mu.Lock(taskId, true)
-	if _, ok := pm.seedSubscribers.Load(taskId); ok {
-		logger.WithTaskID(taskId).Debugf("the task seedSubscribers already exist")
-		if _, ok := pm.taskPieceMetaRecords.Load(taskId); ok {
-			logger.WithTaskID(taskId).Debugf("the task taskPieceMetaRecords already exist")
-			pm.mu.UnLock(taskId, true)
+func (pm *Manager) InitSeedProgress(ctx context.Context, taskID string) {
+	pm.mu.Lock(taskID, true)
+	if _, ok := pm.seedSubscribers.Load(taskID); ok {
+		logger.WithTaskID(taskID).Debugf("the task seedSubscribers already exist")
+		if _, ok := pm.taskPieceMetaRecords.Load(taskID); ok {
+			logger.WithTaskID(taskID).Debugf("the task taskPieceMetaRecords already exist")
+			pm.mu.UnLock(taskID, true)
 			return
 		}
 	}
-	pm.mu.UnLock(taskId, true)
-	pm.mu.Lock(taskId, false)
-	defer pm.mu.UnLock(taskId, false)
-	if _, loaded := pm.seedSubscribers.LoadOrStore(taskId, list.New()); loaded {
-		logger.WithTaskID(taskId).Info("the task seedSubscribers already exist")
+	pm.mu.UnLock(taskID, true)
+	pm.mu.Lock(taskID, false)
+	defer pm.mu.UnLock(taskID, false)
+	if _, loaded := pm.seedSubscribers.LoadOrStore(taskID, list.New()); loaded {
+		logger.WithTaskID(taskID).Info("the task seedSubscribers already exist")
 	}
-	if _, loaded := pm.taskPieceMetaRecords.LoadOrStore(taskId, syncmap.NewSyncMap()); loaded {
-		logger.WithTaskID(taskId).Info("the task taskPieceMetaRecords already exist")
+	if _, loaded := pm.taskPieceMetaRecords.LoadOrStore(taskID, syncmap.NewSyncMap()); loaded {
+		logger.WithTaskID(taskID).Info("the task taskPieceMetaRecords already exist")
 	}
 }
 
-func (pm *Manager) WatchSeedProgress(ctx context.Context, taskId string) (<-chan *types.SeedPiece, error) {
-	logger.Debugf("watch seed progress begin for taskId:%s", taskId)
-	pm.mu.Lock(taskId, true)
-	defer pm.mu.UnLock(taskId, true)
-	chanList, err := pm.seedSubscribers.GetAsList(taskId)
+func (pm *Manager) WatchSeedProgress(ctx context.Context, taskID string) (<-chan *types.SeedPiece, error) {
+	logger.Debugf("watch seed progress begin for taskID:%s", taskID)
+	pm.mu.Lock(taskID, true)
+	defer pm.mu.UnLock(taskID, true)
+	chanList, err := pm.seedSubscribers.GetAsList(taskID)
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to get seed subscribers")
 	}
-	pieceMetaDataRecords, err := pm.getPieceMetaRecordsByTaskId(taskId)
+	pieceMetaDataRecords, err := pm.getPieceMetaRecordsByTaskID(taskID)
 	if err != nil {
-		return nil, errors.Wrap(err, "failed to get piece meta records by taskId")
+		return nil, errors.Wrap(err, "failed to get piece meta records by taskID")
 	}
 	ch := make(chan *types.SeedPiece, pm.buffer)
 	ele := chanList.PushBack(ch)
@@ -106,7 +106,7 @@ func (pm *Manager) WatchSeedProgress(ctx context.Context, taskId string) (<-chan
 			case <-time.After(pm.timeout):
 			}
 		}
-		if task, err := pm.taskMgr.Get(ctx, taskId); err == nil && task.IsDone() {
+		if task, err := pm.taskMgr.Get(ctx, taskID); err == nil && task.IsDone() {
 			chanList.Remove(ele)
 			close(seedCh)
 		}
@@ -115,15 +115,15 @@ func (pm *Manager) WatchSeedProgress(ctx context.Context, taskId string) (<-chan
 }
 
 // Publish publish seedPiece
-func (pm *Manager) PublishPiece(ctx context.Context, taskId string, record *types.SeedPiece) error {
+func (pm *Manager) PublishPiece(ctx context.Context, taskID string, record *types.SeedPiece) error {
 	logger.Debugf("seed piece meta record %+v", record)
-	pm.mu.Lock(taskId, false)
-	defer pm.mu.UnLock(taskId, false)
-	err := pm.setPieceMetaRecord(taskId, record)
+	pm.mu.Lock(taskID, false)
+	defer pm.mu.UnLock(taskID, false)
+	err := pm.setPieceMetaRecord(taskID, record)
 	if err != nil {
 		errors.Wrap(err, "failed to set piece meta record")
 	}
-	chanList, err := pm.seedSubscribers.GetAsList(taskId)
+	chanList, err := pm.seedSubscribers.GetAsList(taskID)
 	if err != nil {
 		return errors.Wrap(err, "failed to get seed subscribers")
 	}
@@ -144,11 +144,11 @@ func (pm *Manager) PublishPiece(ctx context.Context, taskId string, record *type
 	return nil
 }
 
-func (pm *Manager) PublishTask(ctx context.Context, taskId string, task *types.SeedTask) error {
+func (pm *Manager) PublishTask(ctx context.Context, taskID string, task *types.SeedTask) error {
 	logger.Debugf("publish task record %+v", task)
-	pm.mu.Lock(taskId, false)
-	defer pm.mu.UnLock(taskId, false)
-	chanList, err := pm.seedSubscribers.GetAsList(taskId)
+	pm.mu.Lock(taskID, false)
+	defer pm.mu.UnLock(taskID, false)
+	chanList, err := pm.seedSubscribers.GetAsList(taskID)
 	if err != nil {
 		return errors.Wrap(err, "failed to get seed subscribers")
 	}
@@ -198,5 +198,5 @@ func (pm *Manager) Clear(ctx context.Context, taskID string) error {
 func (pm *Manager) GetPieces(ctx context.Context, taskID string) (records []*types.SeedPiece, err error) {
 	pm.mu.Lock(taskID, true)
 	defer pm.mu.UnLock(taskID, true)
-	return pm.getPieceMetaRecordsByTaskId(taskID)
+	return pm.getPieceMetaRecordsByTaskID(taskID)
 }
diff --git a/cdnsystem/daemon/mgr/progress/manager_util.go b/cdnsystem/daemon/mgr/progress/manager_util.go
index c4f7ab1b..3fc3e0f5 100644
--- a/cdnsystem/daemon/mgr/progress/manager_util.go
+++ b/cdnsystem/daemon/mgr/progress/manager_util.go
@@ -33,8 +33,8 @@ func (pm *Manager) setPieceMetaRecord(taskID string, record *types.SeedPiece) er
 	return pieceRecords.Add(strconv.Itoa(int(record.PieceNum)), record)
 }
 
-// getPieceMetaRecordsByTaskId
-func (pm *Manager) getPieceMetaRecordsByTaskId(taskID string) (records []*types.SeedPiece, err error) {
+// getPieceMetaRecordsByTaskID
+func (pm *Manager) getPieceMetaRecordsByTaskID(taskID string) (records []*types.SeedPiece, err error) {
 	pieceRecords, err := pm.taskPieceMetaRecords.GetAsMap(taskID)
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to get piece meta records")
@@ -64,5 +64,3 @@ func (pm *Manager) getPieceMetaRecordsByTaskId(taskID string) (records []*types.
 //	close(sub)
 //	return nil
 //}
-
-
diff --git a/cdnsystem/daemon/mgr/progress_mgr.go b/cdnsystem/daemon/mgr/progress_mgr.go
index 6bc61b70..8d7ff495 100644
--- a/cdnsystem/daemon/mgr/progress_mgr.go
+++ b/cdnsystem/daemon/mgr/progress_mgr.go
@@ -26,20 +26,20 @@ import (
 type SeedProgressMgr interface {
 
 	// InitSeedProgress init task seed progress
-	InitSeedProgress(ctx context.Context, taskId string)
+	InitSeedProgress(context.Context, string)
 
 	// WatchSeedProgress watch task seed progress
-	WatchSeedProgress(ctx context.Context, taskId string) (<-chan *types.SeedPiece, error)
+	WatchSeedProgress(context.Context, string) (<-chan *types.SeedPiece, error)
 
 	// PublishPiece publish piece seed
-	PublishPiece(ctx context.Context, taskId string, record *types.SeedPiece) error
+	PublishPiece(context.Context, string, *types.SeedPiece) error
 
 	// PublishTask publish task seed
-	PublishTask(ctx context.Context, taskId string, record *types.SeedTask) error
+	PublishTask(context.Context, string, *types.SeedTask) error
 
-	// GetPieces get pieces by taskId
-	GetPieces(ctx context.Context, taskId string) (records []*types.SeedPiece, err error)
+	// GetPieces get pieces by taskID
+	GetPieces(context.Context, string) (records []*types.SeedPiece, err error)
 
 	// Clear
-	Clear(ctx context.Context, taskId string) error
-}
\ No newline at end of file
+	Clear(context.Context, string) error
+}
diff --git a/cdnsystem/daemon/mgr/task/manager.go b/cdnsystem/daemon/mgr/task/manager.go
index c8c78e14..fffc70ba 100644
--- a/cdnsystem/daemon/mgr/task/manager.go
+++ b/cdnsystem/daemon/mgr/task/manager.go
@@ -136,21 +136,21 @@ func (tm *Manager) triggerCdnSyncAction(ctx context.Context, task *types.SeedTas
 	return nil
 }
 
-func (tm *Manager) getTask(taskId string) (*types.SeedTask, error) {
-	if stringutils.IsBlank(taskId) {
-		return nil, errors.Wrap(cdnerrors.ErrInvalidValue, "taskId is empty")
+func (tm *Manager) getTask(taskID string) (*types.SeedTask, error) {
+	if stringutils.IsBlank(taskID) {
+		return nil, errors.Wrap(cdnerrors.ErrInvalidValue, "taskID is empty")
 	}
 
-	v, err := tm.taskStore.Get(taskId)
+	v, err := tm.taskStore.Get(taskID)
 	if err != nil {
 		if errors.Cause(err) == dferrors.ErrDataNotFound {
 			return nil, errors.Wrapf(cdnerrors.ErrDataNotFound, "task not found")
 		}
 		return nil, err
 	}
-	// update accessTime for taskId
-	if err := tm.accessTimeMap.Add(taskId, time.Now()); err != nil {
-		logger.WithTaskID(taskId).Warnf("failed to update accessTime: %v", err)
+	// update accessTime for taskID
+	if err := tm.accessTimeMap.Add(taskID, time.Now()); err != nil {
+		logger.WithTaskID(taskID).Warnf("failed to update accessTime: %v", err)
 	}
 	// type assertion
 	if info, ok := v.(*types.SeedTask); ok {
@@ -159,26 +159,26 @@ func (tm *Manager) getTask(taskId string) (*types.SeedTask, error) {
 	return nil, errors.Wrapf(cdnerrors.ErrConvertFailed, "origin object: %+v", v)
 }
 
-func (tm Manager) Get(ctx context.Context, taskId string) (*types.SeedTask, error) {
-	return tm.getTask(taskId)
+func (tm Manager) Get(ctx context.Context, taskID string) (*types.SeedTask, error) {
+	return tm.getTask(taskID)
 }
 
 func (tm Manager) GetAccessTime(ctx context.Context) (*syncmap.SyncMap, error) {
 	return tm.accessTimeMap, nil
 }
 
-func (tm Manager) Delete(ctx context.Context, taskId string) error {
-	tm.accessTimeMap.Delete(taskId)
-	tm.taskURLUnReachableStore.Delete(taskId)
-	tm.taskStore.Delete(taskId)
-	tm.progressMgr.Clear(ctx, taskId)
+func (tm Manager) Delete(ctx context.Context, taskID string) error {
+	tm.accessTimeMap.Delete(taskID)
+	tm.taskURLUnReachableStore.Delete(taskID)
+	tm.taskStore.Delete(taskID)
+	tm.progressMgr.Clear(ctx, taskID)
 	return nil
 }
 
-func (tm *Manager) GetPieces(ctx context.Context, taskId string) (pieces []*types.SeedPiece, err error) {
-	synclock.Lock(taskId, true)
-	defer synclock.UnLock(taskId, true)
-	return tm.progressMgr.GetPieces(ctx, taskId)
+func (tm *Manager) GetPieces(ctx context.Context, taskID string) (pieces []*types.SeedPiece, err error) {
+	synclock.Lock(taskID, true)
+	defer synclock.UnLock(taskID, true)
+	return tm.progressMgr.GetPieces(ctx, taskID)
 }
 
 const (
diff --git a/cdnsystem/daemon/mgr/task/manager_util.go b/cdnsystem/daemon/mgr/task/manager_util.go
index 1b882934..a2a3c248 100644
--- a/cdnsystem/daemon/mgr/task/manager_util.go
+++ b/cdnsystem/daemon/mgr/task/manager_util.go
@@ -40,21 +40,21 @@ func (tm *Manager) addOrUpdateTask(ctx context.Context, request *types.TaskRegis
 	if request.Filter != nil {
 		taskURL = urlutils.FilterURLParam(request.URL, request.Filter)
 	}
-	taskId := request.TaskId
-	synclock.Lock(taskId, false)
-	defer synclock.UnLock(taskId, false)
-	if key, err := tm.taskURLUnReachableStore.Get(taskId); err == nil {
+	taskID := request.TaskId
+	synclock.Lock(taskID, false)
+	defer synclock.UnLock(taskID, false)
+	if key, err := tm.taskURLUnReachableStore.Get(taskID); err == nil {
 		if unReachableStartTime, ok := key.(time.Time); ok &&
 			time.Since(unReachableStartTime) < tm.cfg.FailAccessInterval {
 			return nil, errors.Wrapf(cdnerrors.ErrURLNotReachable,
 				"task hit unReachable cache and interval less than %d, url: %s", tm.cfg.FailAccessInterval, request.URL)
 		}
-		tm.taskURLUnReachableStore.Delete(taskId)
-		logger.Debugf("delete taskId:%s from url unReachable store", taskId)
+		tm.taskURLUnReachableStore.Delete(taskID)
+		logger.Debugf("delete taskID:%s from url unReachable store", taskID)
 	}
 	var task *types.SeedTask
 	newTask := &types.SeedTask{
-		TaskId:           taskId,
+		TaskId:           taskID,
 		Header:           request.Header,
 		RequestMd5:       request.Md5,
 		Url:              request.URL,
@@ -62,16 +62,16 @@ func (tm *Manager) addOrUpdateTask(ctx context.Context, request *types.TaskRegis
 		CdnStatus:        types.TaskInfoCdnStatusWaiting,
 		SourceFileLength: IllegalSourceFileLen,
 	}
-	// using the existing task if it already exists corresponding to taskId
-	if v, err := tm.taskStore.Get(taskId); err == nil {
+	// using the existing task if it already exists corresponding to taskID
+	if v, err := tm.taskStore.Get(taskID); err == nil {
 		existTask := v.(*types.SeedTask)
 		if !isSameTask(existTask, newTask) {
-			return nil, errors.Wrapf(cdnerrors.ErrTaskIdDuplicate, "newTask:%+v, existTask:%+v", newTask, existTask)
+			return nil, errors.Wrapf(cdnerrors.ErrTaskIDDuplicate, "newTask:%+v, existTask:%+v", newTask, existTask)
 		}
 		task = existTask
-		logger.Debugf("get exist task for taskId:%s", taskId)
+		logger.Debugf("get exist task for taskID:%s", taskID)
 	} else {
-		logger.Debugf("get new task for taskId:%s", taskId)
+		logger.Debugf("get new task for taskID:%s", taskID)
 		task = newTask
 	}
 
@@ -85,13 +85,13 @@ func (tm *Manager) addOrUpdateTask(ctx context.Context, request *types.TaskRegis
 		logger.WithTaskID(task.TaskId).Errorf("failed to get url (%s) content length: %v", task.Url, err)
 
 		if cdnerrors.IsURLNotReachable(err) {
-			tm.taskURLUnReachableStore.Add(taskId, time.Now())
+			tm.taskURLUnReachableStore.Add(taskID, time.Now())
 			return nil, err
 		}
 	}
 	// if not support file length header request ,return -1
 	task.SourceFileLength = sourceFileLength
-	logger.WithTaskID(taskId).Debugf("get file content length: %d", sourceFileLength)
+	logger.WithTaskID(taskID).Debugf("get file content length: %d", sourceFileLength)
 
 	// if success to get the information successfully with the req.Header then update the task.Header to req.Header.
 	if request.Header != nil {
@@ -109,9 +109,9 @@ func (tm *Manager) addOrUpdateTask(ctx context.Context, request *types.TaskRegis
 }
 
 // updateTask
-func (tm *Manager) updateTask(taskId string, updateTaskInfo *types.SeedTask) (*types.SeedTask, error) {
-	if stringutils.IsBlank(taskId) {
-		return nil, errors.Wrap(cdnerrors.ErrInvalidValue, "taskId is empty")
+func (tm *Manager) updateTask(taskID string, updateTaskInfo *types.SeedTask) (*types.SeedTask, error) {
+	if stringutils.IsBlank(taskID) {
+		return nil, errors.Wrap(cdnerrors.ErrInvalidValue, "taskID is empty")
 	}
 
 	if updateTaskInfo == nil {
@@ -122,7 +122,7 @@ func (tm *Manager) updateTask(taskId string, updateTaskInfo *types.SeedTask) (*t
 		return nil, errors.Wrap(cdnerrors.ErrInvalidValue, "status of task is empty")
 	}
 	// get origin task
-	task, err := tm.getTask(taskId)
+	task, err := tm.getTask(taskID)
 	if err != nil {
 		return nil, err
 	}
diff --git a/cdnsystem/daemon/mgr/task_mgr.go b/cdnsystem/daemon/mgr/task_mgr.go
index d47e4199..402454e1 100644
--- a/cdnsystem/daemon/mgr/task_mgr.go
+++ b/cdnsystem/daemon/mgr/task_mgr.go
@@ -29,17 +29,17 @@ import (
 type SeedTaskMgr interface {
 
 	// Register register seed task
-	Register(ctx context.Context, registerRequest *types.TaskRegisterRequest) (pieceCh <-chan *types.SeedPiece, err error)
+	Register(context.Context, *types.TaskRegisterRequest) (pieceCh <-chan *types.SeedPiece, err error)
 
 	// Get get task Info with specified taskId.
-	Get(ctx context.Context, taskId string) (*types.SeedTask, error)
+	Get(context.Context, string) (*types.SeedTask, error)
 
 	// GetAccessTime get all tasks accessTime.
-	GetAccessTime(ctx context.Context) (*syncmap.SyncMap, error)
+	GetAccessTime(context.Context) (*syncmap.SyncMap, error)
 
 	// Delete delete a task.
-	Delete(ctx context.Context, taskId string) error
+	Delete(context.Context, string) error
 
 	// GetPieces
-	GetPieces(ctx context.Context, taskId string) (pieces []*types.SeedPiece, err error)
+	GetPieces(context.Context, string) (pieces []*types.SeedPiece, err error)
 }
diff --git a/cdnsystem/server/server.go b/cdnsystem/server/server.go
index 50f128a9..dba51f69 100644
--- a/cdnsystem/server/server.go
+++ b/cdnsystem/server/server.go
@@ -132,14 +132,13 @@ func (s *Server) Serve() (err error) {
 			Type:     manager.ResourceType_Cdn,
 		})
 	}
-	err = rpc.StartTcpServer(s.Config.ListenPort, s.Config.ListenPort, s.seedServer)
+	err = rpc.StartTCPServer(s.Config.ListenPort, s.Config.ListenPort, s.seedServer)
 	if err != nil {
 		return errors.Wrap(err, "failed to start tcp server")
 	}
 	return nil
 }
 
-
 func (s *Server) Stop() {
 	rpc.StopServer()
-}
\ No newline at end of file
+}
diff --git a/cdnsystem/server/service/cdn_seed_server.go b/cdnsystem/server/service/cdn_seed_server.go
index 7317e7d7..e9e7d081 100644
--- a/cdnsystem/server/service/cdn_seed_server.go
+++ b/cdnsystem/server/service/cdn_seed_server.go
@@ -114,10 +114,10 @@ func (css *CdnSeedServer) ObtainSeeds(ctx context.Context, req *cdnsystem.SeedRe
 	if err != nil {
 		return err
 	}
-	peerId := cdnutil.GenCdnPeerId(req.TaskId)
+	peerID := cdnutil.GenCDNPeerID(req.TaskId)
 	for piece := range pieceChan {
 		psc <- &cdnsystem.PieceSeed{
-			PeerId:     peerId,
+			PeerId:     peerID,
 			SeederName: iputils.HostName,
 			PieceInfo: &base.PieceInfo{
 				PieceNum:    piece.PieceNum,
@@ -139,7 +139,7 @@ func (css *CdnSeedServer) ObtainSeeds(ctx context.Context, req *cdnsystem.SeedRe
 		return dferrors.Newf(dfcodes.CdnTaskDownloadFail, "task(%s) status error , status: %s", req.TaskId, task.CdnStatus)
 	}
 	psc <- &cdnsystem.PieceSeed{
-		PeerId:        peerId,
+		PeerId:        peerID,
 		SeederName:    iputils.HostName,
 		Done:          true,
 		ContentLength: task.SourceFileLength,
@@ -172,7 +172,7 @@ func (css *CdnSeedServer) GetPieceTasks(ctx context.Context, req *base.PieceTask
 	}
 	pieces, err := css.taskMgr.GetPieces(ctx, req.TaskId)
 	if err != nil {
-		return nil, dferrors.Newf(dfcodes.CdnError, "failed to get pieces of task(%s) from cdn: %v", err)
+		return nil, dferrors.Newf(dfcodes.CdnError, "failed to get pieces of task(%s) from cdn: %v", task.TaskId, err)
 	}
 	pieceInfos := make([]*base.PieceInfo, 0)
 	var count int32 = 0
diff --git a/cdnsystem/source/httpprotocol/http_source_client.go b/cdnsystem/source/httpprotocol/http_source_client.go
index 3b47ad6e..f6b850ce 100644
--- a/cdnsystem/source/httpprotocol/http_source_client.go
+++ b/cdnsystem/source/httpprotocol/http_source_client.go
@@ -34,18 +34,18 @@ import (
 )
 
 const (
-	HttpClient  = "http"
-	HttpsClient = "https"
+	HTTPClient  = "http"
+	HTTPSClient = "https"
 )
 
 func init() {
-	httpSourceClient := NewHttpSourceClient()
-	source.Register(HttpClient, httpSourceClient)
-	source.Register(HttpsClient, httpSourceClient)
+	httpSourceClient := NewHTTPSourceClient()
+	source.Register(HTTPClient, httpSourceClient)
+	source.Register(HTTPSClient, httpSourceClient)
 }
 
-// NewHttpSourceClient returns a new HttpSourceClient.
-func NewHttpSourceClient() source.ResourceClient {
+// NewHTTPSourceClient returns a new HttpSourceClient.
+func NewHTTPSourceClient() source.ResourceClient {
 	transport := &http.Transport{
 		Proxy: http.ProxyFromEnvironment,
 		DialContext: (&net.Dialer{
diff --git a/cdnsystem/source/ossprotocol/oss_source_client.go b/cdnsystem/source/ossprotocol/oss_source_client.go
index 2277dafd..22ed71d9 100644
--- a/cdnsystem/source/ossprotocol/oss_source_client.go
+++ b/cdnsystem/source/ossprotocol/oss_source_client.go
@@ -63,7 +63,12 @@ func (osc *ossSourceClient) GetContentLength(url string, header map[string]strin
 	if err != nil {
 		return -1, err
 	}
+
 	contentLen, err := strconv.ParseInt(resHeader.Get(oss.HTTPHeaderContentLength), 10, 64)
+	if err != nil {
+		return -1, err
+	}
+
 	return contentLen, nil
 }
 
@@ -183,16 +188,16 @@ type ossObject struct {
 	object string
 }
 
-func ParseOssObject(ossUrl string) (*ossObject, error) {
-	parsedUrl, err := url.Parse(ossUrl)
-	if parsedUrl.Scheme != "oss" {
-		return nil, fmt.Errorf("url:%s is not oss object", ossUrl)
+func ParseOssObject(ossURL string) (*ossObject, error) {
+	url, err := url.Parse(ossURL)
+	if url.Scheme != "oss" {
+		return nil, fmt.Errorf("url:%s is not oss object", ossURL)
 	}
 	if err != nil {
 		return nil, err
 	}
 	return &ossObject{
-		bucket: parsedUrl.Host,
-		object: parsedUrl.Path[1:],
+		bucket: url.Host,
+		object: url.Path[1:],
 	}, nil
 }
diff --git a/cdnsystem/storedriver/store.go b/cdnsystem/storedriver/store.go
index 5a0a6777..4d2ae784 100644
--- a/cdnsystem/storedriver/store.go
+++ b/cdnsystem/storedriver/store.go
@@ -64,7 +64,6 @@ func NewStore(name string, builder StorageBuilder, cfg interface{}) (*Store, err
 	}, nil
 }
 
-
 // Type returns the plugin type: StoragePlugin.
 func (s *Store) Type() config.PluginType {
 	return config.StoragePlugin
@@ -85,7 +84,6 @@ func (s *Store) CreateBaseDir(ctx context.Context) error {
 	return s.driver.CreateBaseDir(ctx)
 }
 
-
 func (s *Store) Exits(ctx context.Context, raw *Raw) bool {
 	return s.driver.Exits(ctx, raw)
 }
diff --git a/client/clientutil/progressbar/progressbar.go b/client/clientutil/progressbar/progressbar.go
index a138a4af..a6278052 100644
--- a/client/clientutil/progressbar/progressbar.go
+++ b/client/clientutil/progressbar/progressbar.go
@@ -31,7 +31,7 @@ import (
 
 	"github.com/mattn/go-runewidth"
 	"github.com/mitchellh/colorstring"
-	"golang.org/x/crypto/ssh/terminal"
+	"golang.org/x/term"
 )
 
 // ProgressBar is a simple progress bar
@@ -681,9 +681,9 @@ func renderProgressBar(c config, s state) (int, error) {
 	}
 
 	if c.fullWidth && !c.ignoreLength {
-		width, _, err := terminal.GetSize(int(os.Stdout.Fd()))
+		width, _, err := term.GetSize(int(os.Stdout.Fd()))
 		if err != nil {
-			width, _, err = terminal.GetSize(int(os.Stderr.Fd()))
+			width, _, err = term.GetSize(int(os.Stderr.Fd()))
 			if err != nil {
 				width = 80
 			}
diff --git a/client/config/constants_otel.go b/client/config/constants_otel.go
index ded98fb5..fdd09bfc 100644
--- a/client/config/constants_otel.go
+++ b/client/config/constants_otel.go
@@ -20,10 +20,10 @@ import "go.opentelemetry.io/otel/attribute"
 
 const (
 	AttributePeerHost          = attribute.Key("d7y.peer.host")
-	AttributeTaskId            = attribute.Key("d7y.peer.task.id")
+	AttributeTaskID            = attribute.Key("d7y.peer.task.id")
 	AttributeTaskContentLength = attribute.Key("d7y.peer.task.content_length")
-	AttributePeerId            = attribute.Key("d7y.peer.id")
-	AttributeTargetPeerId      = attribute.Key("d7y.peer.target.id")
+	AttributePeerID            = attribute.Key("d7y.peer.id")
+	AttributeTargetPeerID      = attribute.Key("d7y.peer.target.id")
 	AttributeTargetPeerAddr    = attribute.Key("d7y.peer.target.addr")
 	AttributeMainPeer          = attribute.Key("d7y.peer.task.main_peer")
 	AttributePeerPacketCode    = attribute.Key("d7y.peer.packet.code")
diff --git a/client/config/peerhost.go b/client/config/peerhost.go
index 43b6d07b..ef417fe0 100644
--- a/client/config/peerhost.go
+++ b/client/config/peerhost.go
@@ -100,7 +100,7 @@ func (p *PeerHostOption) Convert() error {
 	// AdvertiseIP
 	ip := net.ParseIP(p.Host.AdvertiseIP)
 	if ip == nil || net.IPv4zero.Equal(ip) {
-		p.Host.AdvertiseIP = iputils.HostIp
+		p.Host.AdvertiseIP = iputils.HostIP
 	} else {
 		p.Host.AdvertiseIP = ip.String()
 	}
diff --git a/client/config/peerhost_darwin.go b/client/config/peerhost_darwin.go
index af1a2f8c..6a462282 100644
--- a/client/config/peerhost_darwin.go
+++ b/client/config/peerhost_darwin.go
@@ -49,7 +49,7 @@ var peerHostConfig = PeerHostOption{
 	},
 	Host: HostOption{
 		ListenIP:       net.IPv4zero.String(),
-		AdvertiseIP:    iputils.HostIp,
+		AdvertiseIP:    iputils.HostIP,
 		SecurityDomain: "",
 		Location:       "",
 		IDC:            "",
diff --git a/client/config/peerhost_linux.go b/client/config/peerhost_linux.go
index c313c571..33e5fd48 100644
--- a/client/config/peerhost_linux.go
+++ b/client/config/peerhost_linux.go
@@ -49,7 +49,7 @@ var peerHostConfig = PeerHostOption{
 	},
 	Host: HostOption{
 		ListenIP:       "0.0.0.0",
-		AdvertiseIP:    iputils.HostIp,
+		AdvertiseIP:    iputils.HostIP,
 		SecurityDomain: "",
 		Location:       "",
 		IDC:            "",
diff --git a/client/daemon/gc/gc_manager.go b/client/daemon/gc/gc_manager.go
index b77c83d2..42562265 100644
--- a/client/daemon/gc/gc_manager.go
+++ b/client/daemon/gc/gc_manager.go
@@ -51,10 +51,10 @@ func NewManager(interval time.Duration) Manager {
 
 func (g gcManager) Start() {
 	go func() {
-		tick := time.Tick(g.interval)
+		tick := time.NewTicker(g.interval)
 		for {
 			select {
-			case <-tick:
+			case <-tick.C:
 				for name, gc := range allGCTasks {
 					var log = logger.With("component", name)
 					log.Debugf("start gc")
diff --git a/client/daemon/peer/peertask_base.go b/client/daemon/peer/peertask_base.go
index da3116b7..b3e2fc60 100644
--- a/client/daemon/peer/peertask_base.go
+++ b/client/daemon/peer/peertask_base.go
@@ -592,7 +592,7 @@ func (pt *peerTask) preparePieceTasksByPeer(curPeerPacket *scheduler.PeerPacket,
 	}
 	var span trace.Span
 	_, span = tracer.Start(pt.ctx, config.SpanGetPieceTasks)
-	span.SetAttributes(config.AttributeTargetPeerId.String(peer.PeerId))
+	span.SetAttributes(config.AttributeTargetPeerID.String(peer.PeerId))
 	span.SetAttributes(config.AttributeGetPieceStartNum.Int(int(request.StartNum)))
 	span.SetAttributes(config.AttributeGetPieceLimit.Int(int(request.Limit)))
 	defer span.End()
@@ -656,7 +656,7 @@ func (pt *peerTask) getPieceTasks(span trace.Span, curPeerPacket *scheduler.Peer
 		count             int
 	)
 	p, _, err := clientutil.Retry(pt.ctx, func() (interface{}, bool, error) {
-		pp, getErr := dfclient.GetPieceTasks(peer, pt.ctx, request)
+		pp, getErr := dfclient.GetPieceTasks(pt.ctx, peer, request)
 		// when GetPieceTasks returns err, exit retry
 		if getErr != nil {
 			span.RecordError(getErr)
diff --git a/client/daemon/peer/peertask_file.go b/client/daemon/peer/peertask_file.go
index 2dc92dfc..2472d0ae 100644
--- a/client/daemon/peer/peertask_file.go
+++ b/client/daemon/peer/peertask_file.go
@@ -80,7 +80,7 @@ func newFilePeerTask(ctx context.Context,
 	ctx, span := tracer.Start(ctx, config.SpanFilePeerTask, trace.WithSpanKind(trace.SpanKindClient))
 	span.SetAttributes(config.AttributePeerHost.String(host.Uuid))
 	span.SetAttributes(semconv.NetHostIPKey.String(host.Ip))
-	span.SetAttributes(config.AttributePeerId.String(request.PeerId))
+	span.SetAttributes(config.AttributePeerID.String(request.PeerId))
 	span.SetAttributes(semconv.HTTPURLKey.String(request.Url))
 
 	logger.Infof("request overview, url: %s, filter: %s, meta: %s, biz: %s, peer: %s", request.Url, request.Filter, request.UrlMata, request.BizId, request.PeerId)
@@ -110,7 +110,7 @@ func newFilePeerTask(ctx context.Context,
 		err = errors.Errorf("empty schedule result")
 		return ctx, nil, nil, err
 	}
-	span.SetAttributes(config.AttributeTaskId.String(result.TaskId))
+	span.SetAttributes(config.AttributeTaskID.String(result.TaskId))
 	logger.Infof("register task success, task id: %s, peer id: %s, SizeScope: %s",
 		result.TaskId, request.PeerId, base.SizeScope_name[int32(result.SizeScope)])
 
diff --git a/client/daemon/peer/peertask_stream.go b/client/daemon/peer/peertask_stream.go
index ef1c7bec..d09f1045 100644
--- a/client/daemon/peer/peertask_stream.go
+++ b/client/daemon/peer/peertask_stream.go
@@ -63,7 +63,7 @@ func newStreamPeerTask(ctx context.Context,
 	ctx, span := tracer.Start(ctx, config.SpanStreamPeerTask, trace.WithSpanKind(trace.SpanKindClient))
 	span.SetAttributes(config.AttributePeerHost.String(host.Uuid))
 	span.SetAttributes(semconv.NetHostIPKey.String(host.Ip))
-	span.SetAttributes(config.AttributePeerId.String(request.PeerId))
+	span.SetAttributes(config.AttributePeerID.String(request.PeerId))
 	span.SetAttributes(semconv.HTTPURLKey.String(request.Url))
 
 	logger.Debugf("request overview, url: %s, filter: %s, meta: %s, biz: %s", request.Url, request.Filter, request.UrlMata, request.BizId)
@@ -91,7 +91,7 @@ func newStreamPeerTask(ctx context.Context,
 		err = errors.Errorf("empty schedule result")
 		return ctx, nil, nil, err
 	}
-	span.SetAttributes(config.AttributeTaskId.String(result.TaskId))
+	span.SetAttributes(config.AttributeTaskID.String(result.TaskId))
 	logger.Infof("register task success, task id: %s, peer id: %s, SizeScope: %s",
 		result.TaskId, request.PeerId, base.SizeScope_name[int32(result.SizeScope)])
 
diff --git a/client/daemon/peer/piece_manager.go b/client/daemon/peer/piece_manager.go
index 19a8b169..3e94b52b 100644
--- a/client/daemon/peer/piece_manager.go
+++ b/client/daemon/peer/piece_manager.go
@@ -120,7 +120,7 @@ func (pm *pieceManager) DownloadPiece(ctx context.Context, pt PeerTask, request
 	}
 	ctx, span := tracer.Start(ctx, config.SpanWritePiece)
 	request.CalcDigest = pm.calculateDigest && request.piece.PieceMd5 != ""
-	span.SetAttributes(config.AttributeTargetPeerId.String(request.DstPid))
+	span.SetAttributes(config.AttributeTargetPeerID.String(request.DstPid))
 	span.SetAttributes(config.AttributeTargetPeerAddr.String(request.DstAddr))
 	span.SetAttributes(config.AttributePiece.Int(int(request.piece.PieceNum)))
 	r, c, err := pm.pieceDownloader.DownloadPiece(ctx, request)
diff --git a/client/daemon/storage/storage_manager.go b/client/daemon/storage/storage_manager.go
index 4d3c2d36..b0a08b8d 100644
--- a/client/daemon/storage/storage_manager.go
+++ b/client/daemon/storage/storage_manager.go
@@ -504,8 +504,8 @@ func (s *storageManager) TryGC() (bool, error) {
 			continue
 		}
 		_, span := tracer.Start(context.Background(), config.SpanPeerGC)
-		span.SetAttributes(config.AttributePeerId.String(task.(*localTaskStore).PeerID))
-		span.SetAttributes(config.AttributeTaskId.String(task.(*localTaskStore).TaskID))
+		span.SetAttributes(config.AttributePeerID.String(task.(*localTaskStore).PeerID))
+		span.SetAttributes(config.AttributeTaskID.String(task.(*localTaskStore).TaskID))
 		s.tasks.Delete(key)
 		if err := task.(*localTaskStore).Reclaim(); err != nil {
 			// FIXME: retry later or push to queue
diff --git a/client/dfget/dfget.go b/client/dfget/dfget.go
index dd005826..076ea552 100644
--- a/client/dfget/dfget.go
+++ b/client/dfget/dfget.go
@@ -67,7 +67,7 @@ func Download(cfg *config.DfgetConfig, client dfclient.DaemonClient) error {
 	request := &dfdaemongrpc.DownRequest{
 		Url: cfg.URL,
 		UrlMeta: &base.UrlMeta{
-			Digest:    cfg.Digest,
+			Digest: cfg.Digest,
 			Range:  hdr[headers.Range],
 			Header: hdr,
 		},
diff --git a/cmd/cdn/cmd/root.go b/cmd/cdn/cmd/root.go
index c47e15c4..a0ee8232 100644
--- a/cmd/cdn/cmd/root.go
+++ b/cmd/cdn/cmd/root.go
@@ -76,9 +76,9 @@ func runCdnSystem() error {
 	ff := dependency.InitMonitor(cfg.Verbose, cfg.PProfPort, cfg.Jaeger)
 	defer ff()
 
-	if svr, err := server.New(cfg); err != nil {
+	svr, err := server.New(cfg)
+	if err != nil {
 		return err
-	} else {
-		return svr.Serve()
 	}
+	return svr.Serve()
 }
diff --git a/cmd/dependency/dependency.go b/cmd/dependency/dependency.go
index afb3ba36..9aa63b06 100644
--- a/cmd/dependency/dependency.go
+++ b/cmd/dependency/dependency.go
@@ -203,13 +203,14 @@ func initDecoderConfig(dc *mapstructure.DecoderConfig) {
 			reflect.TypeOf(config.CertPool{}),
 			reflect.TypeOf(config.Regexp{}),
 			reflect.TypeOf(clientutil.StorageSize{}):
+
 			b, _ := yaml.Marshal(v)
 			p := reflect.New(to)
 			if err := yaml.Unmarshal(b, p.Interface()); err != nil {
 				return nil, err
-			} else {
-				return p.Interface(), nil
 			}
+
+			return p.Interface(), nil
 		default:
 			return v, nil
 		}
@@ -230,7 +231,7 @@ func initJaegerTracer(url string) (func(), error) {
 		// Record information about this application in an Resource.
 		sdktrace.WithResource(resource.NewWithAttributes(
 			semconv.ServiceNameKey.String("dragonfly"),
-			semconv.ServiceInstanceIDKey.String(fmt.Sprintf("%s|%s", iputils.HostName, iputils.HostIp)),
+			semconv.ServiceInstanceIDKey.String(fmt.Sprintf("%s|%s", iputils.HostName, iputils.HostIP)),
 			semconv.ServiceVersionKey.String(version.GitVersion))),
 	)
 
diff --git a/cmd/dfget/cmd/daemon.go b/cmd/dfget/cmd/daemon.go
index 4c4f56c1..3f062f14 100644
--- a/cmd/dfget/cmd/daemon.go
+++ b/cmd/dfget/cmd/daemon.go
@@ -136,10 +136,10 @@ func runDaemon() error {
 	ff := dependency.InitMonitor(cfg.Verbose, cfg.PProfPort, cfg.Jaeger)
 	defer ff()
 
-	if svr, err := server.New(cfg); err != nil {
+	svr, err := server.New(cfg)
+	if err != nil {
 		return err
-	} else {
-		dependency.SetupQuitSignalHandler(func() { svr.Stop() })
-		return svr.Serve()
 	}
+	dependency.SetupQuitSignalHandler(func() { svr.Stop() })
+	return svr.Serve()
 }
diff --git a/cmd/manager/cmd/root.go b/cmd/manager/cmd/root.go
index 4852bd8d..0c5ecd13 100644
--- a/cmd/manager/cmd/root.go
+++ b/cmd/manager/cmd/root.go
@@ -75,9 +75,9 @@ func runManager() error {
 	ff := dependency.InitMonitor(cfg.Verbose, cfg.PProfPort, cfg.Jaeger)
 	defer ff()
 
-	if svr, err := server.New(cfg); err != nil {
+	svr, err := server.New(cfg)
+	if err != nil {
 		return err
-	} else {
-		return svr.Serve()
 	}
+	return svr.Serve()
 }
diff --git a/cmd/scheduler/cmd/root.go b/cmd/scheduler/cmd/root.go
index 4589b5a3..8cdbb2e5 100644
--- a/cmd/scheduler/cmd/root.go
+++ b/cmd/scheduler/cmd/root.go
@@ -81,9 +81,10 @@ func runScheduler() error {
 	ff := dependency.InitMonitor(cfg.Verbose, cfg.PProfPort, cfg.Jaeger)
 	defer ff()
 
-	if svr, err := server.New(cfg); err != nil {
+	svr, err := server.New(cfg)
+	if err != nil {
 		return err
-	} else {
-		return svr.Serve()
 	}
+
+	return svr.Serve()
 }
diff --git a/internal/dynconfig/dynconfig_manager.go b/internal/dynconfig/dynconfig_manager.go
index 410fe1e6..07081f39 100644
--- a/internal/dynconfig/dynconfig_manager.go
+++ b/internal/dynconfig/dynconfig_manager.go
@@ -23,8 +23,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/cache"
 )
 
-const ()
-
 type dynconfigManager struct {
 	cachePath string
 	cache     cache.Cache
diff --git a/manager/server/server.go b/manager/server/server.go
index d8386894..c4faf9f3 100644
--- a/manager/server/server.go
+++ b/manager/server/server.go
@@ -65,7 +65,7 @@ func New(cfg *config.Config) (*Server, error) {
 func (s *Server) Serve() error {
 	go func() {
 		port := s.cfg.Server.Port
-		err := rpc.StartTcpServer(port, port, s.ms)
+		err := rpc.StartTCPServer(port, port, s.ms)
 		if err != nil {
 			logger.Errorf("failed to start manager tcp server: %+v", err)
 		}
diff --git a/pkg/basic/dfnet/type.go b/pkg/basic/dfnet/type.go
index f093ef1b..732f6ae9 100644
--- a/pkg/basic/dfnet/type.go
+++ b/pkg/basic/dfnet/type.go
@@ -45,7 +45,7 @@ func (n NetAddr) GetEndpoint() string {
 	}
 }
 
-func (n NetAddr) String() string{
+func (n NetAddr) String() string {
 	return n.GetEndpoint()
 }
 
diff --git a/pkg/dferrors/error.go b/pkg/dferrors/error.go
index 68c8c906..ea418a5c 100644
--- a/pkg/dferrors/error.go
+++ b/pkg/dferrors/error.go
@@ -25,12 +25,12 @@ import (
 
 // common and framework errors
 var (
-	ErrInvalidArgument    = errors.New("invalid argument")
-	ErrDataNotFound       = errors.New("data not found")
-	ErrEmptyValue         = errors.New("empty value")
-	ErrConvertFailed      = errors.New("convert failed")
-	ErrEndOfStream        = errors.New("end of stream")
-	ErrNoCandidateNode    = errors.New("candidate server node not found")
+	ErrInvalidArgument = errors.New("invalid argument")
+	ErrDataNotFound    = errors.New("data not found")
+	ErrEmptyValue      = errors.New("empty value")
+	ErrConvertFailed   = errors.New("convert failed")
+	ErrEndOfStream     = errors.New("end of stream")
+	ErrNoCandidateNode = errors.New("candidate server node not found")
 )
 
 func IsEndOfStream(err error) bool {
diff --git a/pkg/dflog/logcore/init.go b/pkg/dflog/logcore/init.go
index 0afab7b0..8dbdbd5b 100644
--- a/pkg/dflog/logcore/init.go
+++ b/pkg/dflog/logcore/init.go
@@ -22,7 +22,7 @@ import (
 
 	"d7y.io/dragonfly/v2/internal/dfpath"
 	"d7y.io/dragonfly/v2/pkg/basic"
-	"d7y.io/dragonfly/v2/pkg/dflog"
+	logger "d7y.io/dragonfly/v2/pkg/dflog"
 )
 
 func InitManager(console bool) error {
@@ -32,23 +32,23 @@ func InitManager(console bool) error {
 
 	logDir := path.Join(basic.HomeDir, "logs/dragonfly")
 
-	if coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false); err != nil {
+	coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetCoreLogger(coreLogger.Sugar())
 	}
+	logger.SetCoreLogger(coreLogger.Sugar())
 
-	if grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false); err != nil {
+	grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGrpcLogger(grpcLogger.Sugar())
 	}
+	logger.SetGrpcLogger(grpcLogger.Sugar())
 
-	if gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false); err != nil {
+	gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGcLogger(gcLogger.Sugar())
 	}
+	logger.SetGcLogger(gcLogger.Sugar())
 
 	return nil
 }
@@ -60,29 +60,29 @@ func InitScheduler(console bool) error {
 
 	logDir := path.Join(basic.HomeDir, "logs/dragonfly")
 
-	if coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false); err != nil {
+	coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetCoreLogger(coreLogger.Sugar())
 	}
+	logger.SetCoreLogger(coreLogger.Sugar())
 
-	if grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false); err != nil {
+	grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGrpcLogger(grpcLogger.Sugar())
 	}
+	logger.SetGrpcLogger(grpcLogger.Sugar())
 
-	if gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false); err != nil {
+	gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGcLogger(gcLogger.Sugar())
 	}
+	logger.SetGcLogger(gcLogger.Sugar())
 
-	if statPeerLogger, err := CreateLogger(path.Join(logDir, "stat/peer.log"), 300, 30, 0, true, true); err != nil {
+	statPeerLogger, err := CreateLogger(path.Join(logDir, "stat/peer.log"), 300, 30, 0, true, true)
+	if err != nil {
 		return err
-	} else {
-		logger.SetStatPeerLogger(statPeerLogger)
 	}
+	logger.SetStatPeerLogger(statPeerLogger)
 
 	return nil
 }
@@ -94,41 +94,41 @@ func InitCdnSystem(console bool) error {
 
 	logDir := path.Join(basic.HomeDir, "logs/dragonfly")
 
-	if coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false); err != nil {
+	coreLogger, err := CreateLogger(path.Join(logDir, CoreLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetCoreLogger(coreLogger.Sugar())
 	}
+	logger.SetCoreLogger(coreLogger.Sugar())
 
-	if grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false); err != nil {
+	grpcLogger, err := CreateLogger(path.Join(logDir, GrpcLogFileName), 300, 30, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGrpcLogger(grpcLogger.Sugar())
 	}
+	logger.SetGrpcLogger(grpcLogger.Sugar())
 
-	if gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false); err != nil {
+	gcLogger, err := CreateLogger(path.Join(logDir, "gc.log"), 300, 7, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGcLogger(gcLogger.Sugar())
 	}
+	logger.SetGcLogger(gcLogger.Sugar())
 
-	if statSeedLogger, err := CreateLogger(path.Join(logDir, "stat/seed.log"), 300, 30, 0, true, true); err != nil {
+	statSeedLogger, err := CreateLogger(path.Join(logDir, "stat/seed.log"), 300, 30, 0, true, true)
+	if err != nil {
 		return err
-	} else {
-		logger.SetStatSeedLogger(statSeedLogger)
 	}
+	logger.SetStatSeedLogger(statSeedLogger)
 
-	if downloaderLogger, err := CreateLogger(path.Join(logDir, "downloader.log"), 300, 7, 0, false, false); err != nil {
+	downloaderLogger, err := CreateLogger(path.Join(logDir, "downloader.log"), 300, 7, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetDownloadLogger(downloaderLogger)
 	}
+	logger.SetDownloadLogger(downloaderLogger)
 
-	if keepAliveLogger, err := CreateLogger(path.Join(logDir, "keepAlive.log"), 300, 7, 0, false, false); err != nil{
+	keepAliveLogger, err := CreateLogger(path.Join(logDir, "keepAlive.log"), 300, 7, 0, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetKeepAliveLogger(keepAliveLogger.Sugar())
 	}
+	logger.SetKeepAliveLogger(keepAliveLogger.Sugar())
 	return nil
 }
 
@@ -137,23 +137,23 @@ func InitDaemon(console bool) error {
 		return nil
 	}
 
-	if coreLogger, err := CreateLogger(path.Join(dfpath.LogDir, fmt.Sprintf("dfdaemon-%s", CoreLogFileName)), 100, 7, 14, false, false); err != nil {
+	coreLogger, err := CreateLogger(path.Join(dfpath.LogDir, fmt.Sprintf("dfdaemon-%s", CoreLogFileName)), 100, 7, 14, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetCoreLogger(coreLogger.Sugar())
 	}
+	logger.SetCoreLogger(coreLogger.Sugar())
 
-	if grpcLogger, err := CreateLogger(path.Join(dfpath.LogDir, fmt.Sprintf("dfdaemon-%s", GrpcLogFileName)), 100, 7, 14, false, false); err != nil {
+	grpcLogger, err := CreateLogger(path.Join(dfpath.LogDir, fmt.Sprintf("dfdaemon-%s", GrpcLogFileName)), 100, 7, 14, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGrpcLogger(grpcLogger.Sugar())
 	}
+	logger.SetGrpcLogger(grpcLogger.Sugar())
 
-	if gcLogger, err := CreateLogger(path.Join(dfpath.LogDir, "gc.log"), 100, 7, 14, false, false); err != nil {
+	gcLogger, err := CreateLogger(path.Join(dfpath.LogDir, "gc.log"), 100, 7, 14, false, false)
+	if err != nil {
 		return err
-	} else {
-		logger.SetGcLogger(gcLogger.Sugar())
 	}
+	logger.SetGcLogger(gcLogger.Sugar())
 
 	return nil
 }
@@ -163,13 +163,13 @@ func InitDfget(console bool) error {
 		return nil
 	}
 
-	if dfgetLogger, err := CreateLogger(path.Join(dfpath.LogDir, "dfget.log"), 300, -1, -1, false, false); err != nil {
+	dfgetLogger, err := CreateLogger(path.Join(dfpath.LogDir, "dfget.log"), 300, -1, -1, false, false)
+	if err != nil {
 		return err
-	} else {
-		log := dfgetLogger.Sugar()
-		logger.SetCoreLogger(log)
-		logger.SetGrpcLogger(log)
 	}
+	log := dfgetLogger.Sugar()
+	logger.SetCoreLogger(log)
+	logger.SetGrpcLogger(log)
 
 	return nil
 }
diff --git a/pkg/dflog/logger.go b/pkg/dflog/logger.go
index d243448a..4e80ca5b 100644
--- a/pkg/dflog/logger.go
+++ b/pkg/dflog/logger.go
@@ -94,9 +94,9 @@ func WithTaskID(taskID string) *SugaredLoggerOnWith {
 	}
 }
 
-func WithPeerID(peerId string) *SugaredLoggerOnWith {
+func WithPeerID(peerID string) *SugaredLoggerOnWith {
 	return &SugaredLoggerOnWith{
-		withArgs: []interface{}{"peerId", peerId},
+		withArgs: []interface{}{"peerID", peerID},
 	}
 }
 
diff --git a/pkg/rpc/base/common/common.go b/pkg/rpc/base/common/common.go
index 08356384..d5989439 100644
--- a/pkg/rpc/base/common/common.go
+++ b/pkg/rpc/base/common/common.go
@@ -17,17 +17,18 @@
 package common
 
 import (
+	"reflect"
+
 	"d7y.io/dragonfly/v2/pkg/dfcodes"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"reflect"
 )
 
 var EndOfPiece = int32(1) << 30
 var ZeroOfPiece = int32(-1)
 
-// cdn peer id suffix
+// CdnSuffix represents cdn peer id suffix
 var CdnSuffix = "_CDN"
 
 func NewGrpcDfError(code base.Code, msg string) *base.GrpcDfError {
@@ -58,4 +59,4 @@ func NewResWithErr(ptr interface{}, err error) interface{} {
 		code = dfcodes.UnknownError
 	}
 	return NewResWithCodeAndMsg(ptr, code, st.Message())
-}
\ No newline at end of file
+}
diff --git a/pkg/rpc/cdnsystem/client/client.go b/pkg/rpc/cdnsystem/client/client.go
index 3bdb8c26..dc95f571 100644
--- a/pkg/rpc/cdnsystem/client/client.go
+++ b/pkg/rpc/cdnsystem/client/client.go
@@ -94,7 +94,7 @@ func (cc *cdnClient) getSeederClientWithTarget(target string) (cdnsystem.SeederC
 }
 
 func (cc *cdnClient) ObtainSeeds(ctx context.Context, sr *cdnsystem.SeedRequest, opts ...grpc.CallOption) (*PieceSeedStream, error) {
-	return newPieceSeedStream(cc, ctx, sr.TaskId, sr, opts)
+	return newPieceSeedStream(ctx, cc, sr.TaskId, sr, opts)
 }
 
 func (cc *cdnClient) GetPieceTasks(ctx context.Context, addr dfnet.NetAddr, req *base.PieceTaskRequest, opts ...grpc.CallOption) (*base.PiecePacket, error) {
@@ -102,11 +102,11 @@ func (cc *cdnClient) GetPieceTasks(ctx context.Context, addr dfnet.NetAddr, req
 		defer func() {
 			logger.WithTaskID(req.TaskId).Infof("invoke cdn node %s GetPieceTasks", addr.GetEndpoint())
 		}()
-		if client, err := cc.getSeederClientWithTarget(addr.GetEndpoint()); err != nil {
+		client, err := cc.getSeederClientWithTarget(addr.GetEndpoint())
+		if err != nil {
 			return nil, err
-		} else {
-			return client.GetPieceTasks(ctx, req, opts...)
 		}
+		return client.GetPieceTasks(ctx, req, opts...)
 	}, 0.2, 2.0, 3, nil)
 	if err == nil {
 		return res.(*base.PiecePacket), nil
diff --git a/pkg/rpc/cdnsystem/client/piece_seed_stream.go b/pkg/rpc/cdnsystem/client/piece_seed_stream.go
index 1a3180d6..ee4032e1 100644
--- a/pkg/rpc/cdnsystem/client/piece_seed_stream.go
+++ b/pkg/rpc/cdnsystem/client/piece_seed_stream.go
@@ -43,7 +43,7 @@ type PieceSeedStream struct {
 	rpc.RetryMeta
 }
 
-func newPieceSeedStream(sc *cdnClient, ctx context.Context, hashKey string, sr *cdnsystem.SeedRequest, opts []grpc.CallOption) (*PieceSeedStream, error) {
+func newPieceSeedStream(ctx context.Context, sc *cdnClient, hashKey string, sr *cdnsystem.SeedRequest, opts []grpc.CallOption) (*PieceSeedStream, error) {
 	pss := &PieceSeedStream{
 		sc:      sc,
 		ctx:     ctx,
@@ -59,9 +59,8 @@ func newPieceSeedStream(sc *cdnClient, ctx context.Context, hashKey string, sr *
 
 	if err := pss.initStream(); err != nil {
 		return nil, err
-	} else {
-		return pss, nil
 	}
+	return pss, nil
 }
 
 func (pss *PieceSeedStream) initStream() error {
@@ -125,11 +124,11 @@ func (pss *PieceSeedStream) replaceStream(key string, cause error) error {
 }
 
 func (pss *PieceSeedStream) replaceClient(key string, cause error) error {
-	if preNode, err := pss.sc.TryMigrate(key, cause, pss.failedServers); err != nil {
+	preNode, err := pss.sc.TryMigrate(key, cause, pss.failedServers)
+	if err != nil {
 		return err
-	} else {
-		pss.failedServers = append(pss.failedServers, preNode)
 	}
+	pss.failedServers = append(pss.failedServers, preNode)
 
 	stream, err := rpc.ExecuteWithRetry(func() (interface{}, error) {
 		client, _, err := pss.sc.getCdnClient(key, true)
diff --git a/pkg/rpc/cdnsystem/server/server.go b/pkg/rpc/cdnsystem/server/server.go
index 53b07164..5deef05e 100644
--- a/pkg/rpc/cdnsystem/server/server.go
+++ b/pkg/rpc/cdnsystem/server/server.go
@@ -58,7 +58,7 @@ func (p *proxy) ObtainSeeds(sr *cdnsystem.SeedRequest, stream cdnsystem.Seeder_O
 	if pe, ok := peer.FromContext(ctx); ok {
 		peerAddr = pe.Addr.String()
 	}
-	logger.Infof("trigger obtain seed for taskId:%s,url:%s,from:%s", sr.TaskId, sr.Url, peerAddr)
+	logger.Infof("trigger obtain seed for taskID:%s,url:%s,from:%s", sr.TaskId, sr.Url, peerAddr)
 
 	errChan := make(chan error, 10)
 	psc := make(chan *cdnsystem.PieceSeed, 4)
@@ -121,21 +121,20 @@ func call(ctx context.Context, psc chan *cdnsystem.PieceSeed, p *proxy, sr *cdns
 	}
 }
 
-func StatSeedStart(taskId, url string) {
+func StatSeedStart(taskID, url string) {
 	logger.StatSeedLogger.Info("trigger seed making",
-		zap.String("taskId", taskId),
+		zap.String("taskID", taskID),
 		zap.String("url", url),
-		zap.String("seederIp", iputils.HostIp),
+		zap.String("seederIp", iputils.HostIP),
 		zap.String("seederName", iputils.HostName))
 }
 
-
-func StatSeedFinish(taskId, url string, success bool, err error, beginTime, endTime int, traffic, contentLength int64) {
+func StatSeedFinish(taskID, url string, success bool, err error, beginTime, endTime int, traffic, contentLength int64) {
 	logger.StatSeedLogger.Info("seed making finish",
 		zap.Bool("success", success),
-		zap.String("taskId", taskId),
+		zap.String("taskID", taskID),
 		zap.String("url", url),
-		zap.String("seederIp", iputils.HostIp),
+		zap.String("seederIp", iputils.HostIP),
 		zap.String("seederName", iputils.HostName),
 		zap.Int("beginTime", beginTime),
 		zap.Int("endTime", endTime),
diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go
index 3ffd58c9..2231c4cf 100644
--- a/pkg/rpc/client.go
+++ b/pkg/rpc/client.go
@@ -239,16 +239,17 @@ func (conn *Connection) findCandidateClientConn(key string, exclusiveNodes ...st
 			}, nil
 		}
 		logger.With("conn", conn.name).Debugf("attempt to connect candidateNode %s for hash key %s", candidateNode, key)
-		if clientConn, err := conn.createClient(candidateNode, append(defaultClientOpts, conn.dialOpts...)...); err == nil {
+		clientConn, err := conn.createClient(candidateNode, append(defaultClientOpts, conn.dialOpts...)...)
+		if err == nil {
 			logger.With("conn", conn.name).Infof("success connect to candidateNode %s for hash key %s", candidateNode, key)
 			conn.rwMutex.UnLock(candidateNode, true)
 			return &candidateClient{
 				node: candidateNode,
 				Ref:  clientConn,
 			}, nil
-		} else {
-			logger.With("conn", conn.name).Infof("failed to connect candidateNode %s for hash key %s: %v", candidateNode, key, err)
 		}
+
+		logger.With("conn", conn.name).Infof("failed to connect candidateNode %s for hash key %s: %v", candidateNode, key, err)
 		conn.rwMutex.UnLock(candidateNode, true)
 	}
 	return nil, dferrors.ErrNoCandidateNode
@@ -300,15 +301,17 @@ func (conn *Connection) loadOrCreateClientConnByNode(node string) (clientConn *g
 		logger.With("conn", conn.name).Debugf("hit cache clientConn associated with node %s", node)
 		return client.(*grpc.ClientConn), nil
 	}
+
 	logger.With("conn", conn.name).Debugf("failed to load clientConn associated with node %s, attempt to create it", node)
-	if clientConn, err := conn.createClient(node, append(defaultClientOpts, conn.dialOpts...)...); err == nil {
+	clientConn, err = conn.createClient(node, append(defaultClientOpts, conn.dialOpts...)...)
+	if err == nil {
 		logger.With("conn", conn.name).Infof("success connect to node %s", node)
 		// bind
 		conn.node2ClientMap.Store(node, clientConn)
 		return clientConn, nil
-	} else {
-		return nil, errors.Wrapf(err, "cannot found clientConn associated with node %s and create client conn failed", node)
 	}
+
+	return nil, errors.Wrapf(err, "cannot found clientConn associated with node %s and create client conn failed", node)
 }
 
 // GetClientConn get conn or bind hashKey to candidate node, don't do the migrate action
diff --git a/pkg/rpc/client_util.go b/pkg/rpc/client_util.go
index 89aa5609..8764aaa7 100644
--- a/pkg/rpc/client_util.go
+++ b/pkg/rpc/client_util.go
@@ -51,7 +51,7 @@ func (conn *Connection) startGC() {
 			// range all connections and determine whether they are expired
 			conn.accessNodeMap.Range(func(node, accessTime interface{}) bool {
 				serverNode := node.(string)
-				totalNodeSize += 1
+				totalNodeSize++
 				atime := accessTime.(time.Time)
 				if time.Since(atime) < conn.connExpireTime {
 					return true
diff --git a/pkg/rpc/dfdaemon/client/client.go b/pkg/rpc/dfdaemon/client/client.go
index 34d99687..75d80cd8 100644
--- a/pkg/rpc/dfdaemon/client/client.go
+++ b/pkg/rpc/dfdaemon/client/client.go
@@ -80,11 +80,11 @@ type daemonClient struct {
 }
 
 func (dc *daemonClient) getDaemonClient(key string, stick bool) (dfdaemon.DaemonClient, string, error) {
-	if clientConn, err := dc.Connection.GetClientConn(key, stick); err != nil {
+	clientConn, err := dc.Connection.GetClientConn(key, stick)
+	if err != nil {
 		return nil, "", err
-	} else {
-		return dfdaemon.NewDaemonClient(clientConn), clientConn.Target(), nil
 	}
+	return dfdaemon.NewDaemonClient(clientConn), clientConn.Target(), nil
 }
 
 func (dc *daemonClient) getDaemonClientWithTarget(target string) (dfdaemon.DaemonClient, error) {
@@ -97,19 +97,19 @@ func (dc *daemonClient) getDaemonClientWithTarget(target string) (dfdaemon.Daemo
 
 func (dc *daemonClient) Download(ctx context.Context, req *dfdaemon.DownRequest, opts ...grpc.CallOption) (*DownResultStream, error) {
 	req.Uuid = uuid.New().String()
-	// generate taskId
-	taskId := idgen.TaskID(req.Url, req.Filter, req.UrlMeta, req.BizId)
-	return newDownResultStream(dc, ctx, taskId, req, opts)
+	// generate taskID
+	taskID := idgen.TaskID(req.Url, req.Filter, req.UrlMeta, req.BizId)
+	return newDownResultStream(ctx, dc, taskID, req, opts)
 }
 
 func (dc *daemonClient) GetPieceTasks(ctx context.Context, target dfnet.NetAddr, ptr *base.PieceTaskRequest, opts ...grpc.CallOption) (*base.PiecePacket,
 	error) {
 	res, err := rpc.ExecuteWithRetry(func() (interface{}, error) {
-		if client, err := dc.getDaemonClientWithTarget(target.GetEndpoint()); err != nil {
+		client, err := dc.getDaemonClientWithTarget(target.GetEndpoint())
+		if err != nil {
 			return nil, err
-		} else {
-			return client.GetPieceTasks(ctx, ptr, opts...)
 		}
+		return client.GetPieceTasks(ctx, ptr, opts...)
 	}, 0.2, 2.0, 3, nil)
 
 	if err == nil {
@@ -121,11 +121,11 @@ func (dc *daemonClient) GetPieceTasks(ctx context.Context, target dfnet.NetAddr,
 
 func (dc *daemonClient) CheckHealth(ctx context.Context, target dfnet.NetAddr, opts ...grpc.CallOption) (err error) {
 	_, err = rpc.ExecuteWithRetry(func() (interface{}, error) {
-		if client, err := dc.getDaemonClientWithTarget(target.GetEndpoint()); err != nil {
+		client, err := dc.getDaemonClientWithTarget(target.GetEndpoint())
+		if err != nil {
 			return nil, errors.Wrapf(err, "failed to connect server %s", target.GetEndpoint())
-		} else {
-			return client.CheckHealth(ctx, new(empty.Empty), opts...)
 		}
+		return client.CheckHealth(ctx, new(empty.Empty), opts...)
 	}, 0.2, 2.0, 3, nil)
 
 	return
diff --git a/pkg/rpc/dfdaemon/client/down_result_stream.go b/pkg/rpc/dfdaemon/client/down_result_stream.go
index 0c876e1b..866c0460 100644
--- a/pkg/rpc/dfdaemon/client/down_result_stream.go
+++ b/pkg/rpc/dfdaemon/client/down_result_stream.go
@@ -41,7 +41,7 @@ type DownResultStream struct {
 	rpc.RetryMeta
 }
 
-func newDownResultStream(dc *daemonClient, ctx context.Context, hashKey string, req *dfdaemon.DownRequest, opts []grpc.CallOption) (*DownResultStream, error) {
+func newDownResultStream(ctx context.Context, dc *daemonClient, hashKey string, req *dfdaemon.DownRequest, opts []grpc.CallOption) (*DownResultStream, error) {
 	drs := &DownResultStream{
 		dc:      dc,
 		ctx:     ctx,
@@ -58,9 +58,8 @@ func newDownResultStream(dc *daemonClient, ctx context.Context, hashKey string,
 
 	if err := drs.initStream(); err != nil {
 		return nil, err
-	} else {
-		return drs, nil
 	}
+	return drs, nil
 }
 
 func (drs *DownResultStream) initStream() error {
@@ -134,11 +133,11 @@ func (drs *DownResultStream) replaceStream(cause error) error {
 }
 
 func (drs *DownResultStream) replaceClient(cause error) error {
-	if preNode, err := drs.dc.TryMigrate(drs.hashKey, cause, drs.failedServers); err != nil {
+	preNode, err := drs.dc.TryMigrate(drs.hashKey, cause, drs.failedServers)
+	if err != nil {
 		return err
-	} else {
-		drs.failedServers = append(drs.failedServers, preNode)
 	}
+	drs.failedServers = append(drs.failedServers, preNode)
 
 	stream, err := rpc.ExecuteWithRetry(func() (interface{}, error) {
 		client, _, err := drs.dc.getDaemonClient(drs.hashKey, true)
diff --git a/pkg/rpc/dfdaemon/client/peer.go b/pkg/rpc/dfdaemon/client/peer.go
index 1a0e258d..f00ec329 100644
--- a/pkg/rpc/dfdaemon/client/peer.go
+++ b/pkg/rpc/dfdaemon/client/peer.go
@@ -30,10 +30,10 @@ import (
 	"google.golang.org/grpc"
 )
 
-func GetPieceTasks(destPeer *scheduler.PeerPacket_DestPeer, ctx context.Context, ptr *base.PieceTaskRequest, opts ...grpc.CallOption) (*base.PiecePacket, error) {
+func GetPieceTasks(ctx context.Context, destPeer *scheduler.PeerPacket_DestPeer, ptr *base.PieceTaskRequest, opts ...grpc.CallOption) (*base.PiecePacket, error) {
 	destAddr := fmt.Sprintf("%s:%d", destPeer.Ip, destPeer.RpcPort)
-	peerId := destPeer.PeerId
-	toCdn := strings.HasSuffix(peerId, common.CdnSuffix)
+	peerID := destPeer.PeerId
+	toCdn := strings.HasSuffix(peerID, common.CdnSuffix)
 	var err error
 	netAddr := dfnet.NetAddr{
 		Type: dfnet.TCP,
@@ -52,7 +52,6 @@ func GetPieceTasks(destPeer *scheduler.PeerPacket_DestPeer, ctx context.Context,
 func getClient(netAddr dfnet.NetAddr, toCdn bool) (rpc.Closer, error) {
 	if toCdn {
 		return cdnclient.GetElasticClientByAdders([]dfnet.NetAddr{netAddr})
-	} else {
-		return GetElasticClientByAdders([]dfnet.NetAddr{netAddr})
 	}
+	return GetElasticClientByAdders([]dfnet.NetAddr{netAddr})
 }
diff --git a/pkg/rpc/dfdaemon/server/server.go b/pkg/rpc/dfdaemon/server/server.go
index 93d14e72..1af0106c 100644
--- a/pkg/rpc/dfdaemon/server/server.go
+++ b/pkg/rpc/dfdaemon/server/server.go
@@ -18,6 +18,8 @@ package server
 
 import (
 	"context"
+	"sync"
+
 	"d7y.io/dragonfly/v2/pkg/dferrors"
 	logger "d7y.io/dragonfly/v2/pkg/dflog"
 	"d7y.io/dragonfly/v2/pkg/rpc"
@@ -27,7 +29,6 @@ import (
 	"github.com/golang/protobuf/ptypes/empty"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/peer"
-	"sync"
 )
 
 func init() {
diff --git a/pkg/rpc/examples/cdnsystem/server/main.go b/pkg/rpc/examples/cdnsystem/server/main.go
index 703455d2..1b41efea 100644
--- a/pkg/rpc/examples/cdnsystem/server/main.go
+++ b/pkg/rpc/examples/cdnsystem/server/main.go
@@ -16,18 +16,16 @@
 
 package main
 
-import (
-	"d7y.io/dragonfly/v2/pkg/dflog/logcore"
-	"d7y.io/dragonfly/v2/pkg/rpc"
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
-	_ "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/server"
-)
 import (
 	"context"
 	"fmt"
 	"time"
 
+	"d7y.io/dragonfly/v2/pkg/dflog/logcore"
+	"d7y.io/dragonfly/v2/pkg/rpc"
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
+	_ "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/server"
 	"d7y.io/dragonfly/v2/pkg/safe"
 )
 
@@ -66,7 +64,7 @@ func (hs *helloSeeder) GetPieceTasks(context.Context, *base.PieceTaskRequest) (*
 
 func main() {
 	logcore.InitCdnSystem(false)
-	err := rpc.StartTcpServer(12345, 12345, &helloSeeder{})
+	err := rpc.StartTCPServer(12345, 12345, &helloSeeder{})
 
 	if err != nil {
 		fmt.Printf("finish error:%v\n", err)
diff --git a/pkg/rpc/manager/client/client.go b/pkg/rpc/manager/client/client.go
index 1f58f430..0b6fc0c7 100644
--- a/pkg/rpc/manager/client/client.go
+++ b/pkg/rpc/manager/client/client.go
@@ -217,7 +217,7 @@ func (mc *managerClient) GetCdnClusterConfig(ctx context.Context, req *manager.G
 	return cc, nil
 }
 
-func init()  {
+func init() {
 	var mc *managerClient = nil
 	var _ ManagerClient = mc
 }
diff --git a/pkg/rpc/manager/server/server.go b/pkg/rpc/manager/server/server.go
index 67c75e2e..6f778b6c 100644
--- a/pkg/rpc/manager/server/server.go
+++ b/pkg/rpc/manager/server/server.go
@@ -18,6 +18,7 @@ package server
 
 import (
 	"context"
+
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/manager"
 	"github.com/golang/protobuf/ptypes/empty"
diff --git a/pkg/rpc/scheduler/client/client.go b/pkg/rpc/scheduler/client/client.go
index 088e2fd6..ed068820 100644
--- a/pkg/rpc/scheduler/client/client.go
+++ b/pkg/rpc/scheduler/client/client.go
@@ -66,7 +66,7 @@ func GetSchedulerByConfigServer(cfgServerAddr string, opts ...grpc.DialOption) (
 	// todo create HostTag
 	HostTag := ""
 	schedulers, err := configServer.GetSchedulers(context.Background(), &manager.GetSchedulersRequest{
-		Ip:       iputils.HostIp,
+		Ip:       iputils.HostIP,
 		HostName: iputils.HostName,
 		HostTag:  HostTag,
 	})
@@ -93,13 +93,13 @@ func GetSchedulerByConfigServer(cfgServerAddr string, opts ...grpc.DialOption) (
 
 // see scheduler.SchedulerClient
 type SchedulerClient interface {
-	RegisterPeerTask(ctx context.Context, ptr *scheduler.PeerTaskRequest, opts ...grpc.CallOption) (*scheduler.RegisterResult, error)
+	RegisterPeerTask(context.Context, *scheduler.PeerTaskRequest, ...grpc.CallOption) (*scheduler.RegisterResult, error)
 	// IsMigrating of ptr will be set to true
-	ReportPieceResult(ctx context.Context, taskId string, ptr *scheduler.PeerTaskRequest, opts ...grpc.CallOption) (PeerPacketStream, error)
+	ReportPieceResult(context.Context, string, *scheduler.PeerTaskRequest, ...grpc.CallOption) (PeerPacketStream, error)
 
-	ReportPeerResult(ctx context.Context, pr *scheduler.PeerResult, opts ...grpc.CallOption) error
+	ReportPeerResult(context.Context, *scheduler.PeerResult, ...grpc.CallOption) error
 
-	LeaveTask(ctx context.Context, pt *scheduler.PeerTarget, opts ...grpc.CallOption) error
+	LeaveTask(context.Context, *scheduler.PeerTarget, ...grpc.CallOption) error
 
 	Close() error
 }
@@ -109,11 +109,11 @@ type schedulerClient struct {
 }
 
 func (sc *schedulerClient) getSchedulerClient(key string, stick bool) (scheduler.SchedulerClient, string, error) {
-	if clientConn, err := sc.Connection.GetClientConn(key, stick); err != nil {
+	clientConn, err := sc.Connection.GetClientConn(key, stick)
+	if err != nil {
 		return nil, "", err
-	} else {
-		return scheduler.NewSchedulerClient(clientConn), clientConn.Target(), nil
 	}
+	return scheduler.NewSchedulerClient(clientConn), clientConn.Target(), nil
 }
 
 func (sc *schedulerClient) RegisterPeerTask(ctx context.Context, ptr *scheduler.PeerTaskRequest, opts ...grpc.CallOption) (rr *scheduler.RegisterResult,
@@ -168,13 +168,13 @@ func (sc *schedulerClient) doRegisterPeerTask(ctx context.Context, ptr *schedule
 	return
 }
 
-func (sc *schedulerClient) ReportPieceResult(ctx context.Context, taskId string, ptr *scheduler.PeerTaskRequest, opts ...grpc.CallOption) (PeerPacketStream, error) {
-	pps, err := newPeerPacketStream(sc, ctx, taskId, ptr, opts)
+func (sc *schedulerClient) ReportPieceResult(ctx context.Context, taskID string, ptr *scheduler.PeerTaskRequest, opts ...grpc.CallOption) (PeerPacketStream, error) {
+	pps, err := newPeerPacketStream(ctx, sc, taskID, ptr, opts)
 
-	logger.With("peerId", ptr.PeerId, "errMsg", err).Infof("start to report piece result for taskId:%s", taskId)
+	logger.With("peerId", ptr.PeerId, "errMsg", err).Infof("start to report piece result for taskID:%s", taskID)
 
 	// trigger scheduling
-	pps.Send(scheduler.NewZeroPieceResult(taskId, ptr.PeerId))
+	pps.Send(scheduler.NewZeroPieceResult(taskID, ptr.PeerId))
 	return pps, err
 }
 
diff --git a/pkg/rpc/scheduler/client/peer_packet_stream.go b/pkg/rpc/scheduler/client/peer_packet_stream.go
index 49ef1359..a62bbf01 100644
--- a/pkg/rpc/scheduler/client/peer_packet_stream.go
+++ b/pkg/rpc/scheduler/client/peer_packet_stream.go
@@ -21,8 +21,6 @@ import (
 	"io"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/dfcodes"
-	"d7y.io/dragonfly/v2/pkg/dferrors"
 	"github.com/pkg/errors"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
@@ -53,7 +51,7 @@ type peerPacketStream struct {
 	retryMeta rpc.RetryMeta
 }
 
-func newPeerPacketStream(sc *schedulerClient, ctx context.Context, hashKey string, ptr *scheduler.PeerTaskRequest, opts []grpc.CallOption) (PeerPacketStream, error) {
+func newPeerPacketStream(ctx context.Context, sc *schedulerClient, hashKey string, ptr *scheduler.PeerTaskRequest, opts []grpc.CallOption) (PeerPacketStream, error) {
 	ptr.IsMigrating = true
 
 	pps := &peerPacketStream{
@@ -71,9 +69,8 @@ func newPeerPacketStream(sc *schedulerClient, ctx context.Context, hashKey strin
 
 	if err := pps.initStream(); err != nil {
 		return nil, err
-	} else {
-		return pps, nil
 	}
+	return pps, nil
 }
 
 func (pps *peerPacketStream) Send(pr *scheduler.PieceResult) (err error) {
@@ -104,12 +101,6 @@ func (pps *peerPacketStream) Recv() (pp *scheduler.PeerPacket, err error) {
 		pp, err = pps.retryRecv(err)
 	}
 	return
-	if err != nil && err != io.EOF {
-		if e, ok := err.(*dferrors.DfError); ok && e.Code == dfcodes.PeerTaskNotFound {
-			pp, err = pps.retryRecv(err)
-		}
-	}
-	return
 }
 
 func (pps *peerPacketStream) retrySend(pr *scheduler.PieceResult, cause error) error {
@@ -196,11 +187,11 @@ func (pps *peerPacketStream) replaceStream(cause error) error {
 }
 
 func (pps *peerPacketStream) replaceClient(cause error) error {
-	if preNode, err := pps.sc.TryMigrate(pps.hashKey, cause, pps.failedServers); err != nil {
+	preNode, err := pps.sc.TryMigrate(pps.hashKey, cause, pps.failedServers)
+	if err != nil {
 		return err
-	} else {
-		pps.failedServers = append(pps.failedServers, preNode)
 	}
+	pps.failedServers = append(pps.failedServers, preNode)
 
 	stream, err := rpc.ExecuteWithRetry(func() (interface{}, error) {
 		client, _, err := pps.sc.getSchedulerClient(pps.hashKey, true)
diff --git a/pkg/rpc/scheduler/scheduler.go b/pkg/rpc/scheduler/scheduler.go
index 22a55b8c..8215d10f 100644
--- a/pkg/rpc/scheduler/scheduler.go
+++ b/pkg/rpc/scheduler/scheduler.go
@@ -20,18 +20,18 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
 )
 
-func NewZeroPieceResult(taskId, peerId string) *PieceResult {
+func NewZeroPieceResult(taskID, peerID string) *PieceResult {
 	return &PieceResult{
-		TaskId:   taskId,
-		SrcPid:   peerId,
+		TaskId:   taskID,
+		SrcPid:   peerID,
 		PieceNum: common.ZeroOfPiece,
 	}
 }
 
-func NewEndPieceResult(taskId, peerId string, finishedCount int32) *PieceResult {
+func NewEndPieceResult(taskID, peerID string, finishedCount int32) *PieceResult {
 	return &PieceResult{
-		TaskId:        taskId,
-		SrcPid:        peerId,
+		TaskId:        taskID,
+		SrcPid:        peerID,
 		PieceNum:      common.EndOfPiece,
 		FinishedCount: finishedCount,
 	}
diff --git a/pkg/rpc/scheduler/server/server.go b/pkg/rpc/scheduler/server/server.go
index c4cbc485..f5e34cb3 100644
--- a/pkg/rpc/scheduler/server/server.go
+++ b/pkg/rpc/scheduler/server/server.go
@@ -57,24 +57,24 @@ type SchedulerServer interface {
 func (p *proxy) RegisterPeerTask(ctx context.Context, ptr *scheduler.PeerTaskRequest) (rr *scheduler.RegisterResult, err error) {
 	rr, err = p.server.RegisterPeerTask(ctx, ptr)
 
-	var taskId = "unknown"
+	var taskID = "unknown"
 	var suc bool
 	var code base.Code
 
 	if err == nil && rr != nil {
-		taskId = rr.TaskId
+		taskID = rr.TaskId
 	}
 
 	peerHost := ptr.PeerHost
 
 	logger.StatPeerLogger.Info("register peer task",
 		zap.Bool("success", suc),
-		zap.String("taskId", taskId),
+		zap.String("taskID", taskID),
 		zap.String("url", ptr.Url),
 		zap.String("peerIp", peerHost.Ip),
 		zap.String("securityDomain", peerHost.SecurityDomain),
 		zap.String("idc", peerHost.Idc),
-		zap.String("schedulerIp", iputils.HostIp),
+		zap.String("schedulerIp", iputils.HostIP),
 		zap.String("schedulerName", iputils.HostName),
 		zap.Int32("code", int32(code)))
 
@@ -90,12 +90,12 @@ func (p *proxy) ReportPeerResult(ctx context.Context, pr *scheduler.PeerResult)
 
 	logger.StatPeerLogger.Info("finish peer task",
 		zap.Bool("success", pr.Success),
-		zap.String("taskId", pr.TaskId),
+		zap.String("taskID", pr.TaskId),
 		zap.String("url", pr.Url),
 		zap.String("peerIp", pr.SrcIp),
 		zap.String("securityDomain", pr.SecurityDomain),
 		zap.String("idc", pr.Idc),
-		zap.String("schedulerIp", iputils.HostIp),
+		zap.String("schedulerIp", iputils.HostIP),
 		zap.String("schedulerName", iputils.HostName),
 		zap.Int64("contentLength", pr.ContentLength),
 		zap.Uint64("traffic", uint64(pr.Traffic)),
diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go
index d514f60d..b2daea3a 100644
--- a/pkg/rpc/server.go
+++ b/pkg/rpc/server.go
@@ -85,7 +85,7 @@ var sp = struct {
 	once sync.Once
 }{ch: make(chan struct{})}
 
-func GetTcpServerPort() int {
+func GetTCPServerPort() int {
 	sp.once.Do(func() {
 		<-sp.ch
 	})
@@ -94,7 +94,7 @@ func GetTcpServerPort() int {
 }
 
 // for client, start tcp first and then start unix on server process
-func StartTcpServer(incrementPort int, upLimit int, impl interface{}, opts ...grpc.ServerOption) error {
+func StartTCPServer(incrementPort int, upLimit int, impl interface{}, opts ...grpc.ServerOption) error {
 	for {
 		if incrementPort > upLimit {
 			return errors.New("no ports available")
@@ -125,9 +125,9 @@ func StartUnixServer(sockPath string, impl interface{}, opts ...grpc.ServerOptio
 
 	if err := startServer(netAddr, impl, opts); err != nil {
 		return err
-	} else {
-		return nil
 	}
+
+	return nil
 }
 
 // start server with addr and register source
@@ -148,12 +148,13 @@ func startServer(netAddr dfnet.NetAddr, impl interface{}, opts []grpc.ServerOpti
 
 		addr := lis.Addr().String()
 		index := strings.LastIndex(addr, ":")
-		if p, err := strconv.Atoi(stringutils.SubString(addr, index+1, len(addr))); err != nil {
+		p, err := strconv.Atoi(stringutils.SubString(addr, index+1, len(addr)))
+		if err != nil {
 			return err
-		} else {
-			sp.port = p
-			close(sp.ch)
 		}
+
+		sp.port = p
+		close(sp.ch)
 	}
 
 	register(server, impl)
diff --git a/pkg/safe/safe.go b/pkg/safe/safe.go
index 779436ea..73553db8 100644
--- a/pkg/safe/safe.go
+++ b/pkg/safe/safe.go
@@ -17,7 +17,6 @@
 package safe
 
 import (
-	"errors"
 	"fmt"
 	"runtime/debug"
 )
@@ -26,7 +25,7 @@ import (
 func Call(f func()) (err error) {
 	defer func() {
 		if desc := recover(); desc != nil {
-			err = errors.New(fmt.Sprintf("%v", desc))
+			err = fmt.Errorf("%v", desc)
 			debug.PrintStack()
 		}
 	}()
diff --git a/pkg/slidingwindow/slidingwindow.go b/pkg/slidingwindow/slidingwindow.go
index 440acd2f..a0149e43 100644
--- a/pkg/slidingwindow/slidingwindow.go
+++ b/pkg/slidingwindow/slidingwindow.go
@@ -66,7 +66,7 @@ func (w *WindowStatus) AddCount(n uint) {
 	w.Set(n)
 
 	for w.Test(w.start) {
-		w.start += 1
+		w.start++
 	}
 }
 
diff --git a/pkg/structure/maputils/maputils.go b/pkg/structure/maputils/maputils.go
index 5c053dc9..3c8df762 100644
--- a/pkg/structure/maputils/maputils.go
+++ b/pkg/structure/maputils/maputils.go
@@ -25,4 +25,4 @@ func DeepCopyMap(dst, src map[string]string) map[string]string {
 		dst[k] = v
 	}
 	return dst
-}
\ No newline at end of file
+}
diff --git a/pkg/structure/sortedlist/bucket.go b/pkg/structure/sortedlist/bucket.go
index e31dd8b7..ef17112b 100644
--- a/pkg/structure/sortedlist/bucket.go
+++ b/pkg/structure/sortedlist/bucket.go
@@ -1,9 +1,25 @@
+/*
+ *     Copyright 2020 The Dragonfly Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package sortedlist
 
 type empty struct{}
 
 type bucket struct {
-	count int
+	count   int
 	buckets []map[Item]empty
 }
 
@@ -31,4 +47,3 @@ func (b *bucket) Delete(key int, data Item) {
 	}
 	return
 }
-
diff --git a/pkg/structure/sortedlist/sorted_list.go b/pkg/structure/sortedlist/sorted_list.go
index 764645df..fc36e564 100644
--- a/pkg/structure/sortedlist/sorted_list.go
+++ b/pkg/structure/sortedlist/sorted_list.go
@@ -1,3 +1,19 @@
+/*
+ *     Copyright 2020 The Dragonfly Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package sortedlist
 
 import (
@@ -110,7 +126,7 @@ func (l *SortedList) Range(fn func(data Item) bool) {
 	l.RangeLimit(-1, fn)
 }
 
-func (l *SortedList) RangeLimit(limit int ,fn func(Item) bool) {
+func (l *SortedList) RangeLimit(limit int, fn func(Item) bool) {
 	if limit == 0 {
 		return
 	}
@@ -118,7 +134,7 @@ func (l *SortedList) RangeLimit(limit int ,fn func(Item) bool) {
 	defer l.l.RUnlock()
 
 	count := 0
-	for i := l.left; i<=l.right; i++ {
+	for i := l.left; i <= l.right; i++ {
 		buc := l.buckets[i]
 		for _, b := range buc.buckets {
 			for it := range b {
@@ -138,7 +154,7 @@ func (l *SortedList) RangeReverse(fn func(data Item) bool) {
 	l.RangeReverseLimit(-1, fn)
 }
 
-func (l *SortedList) RangeReverseLimit(limit int ,fn func(Item) bool) {
+func (l *SortedList) RangeReverseLimit(limit int, fn func(Item) bool) {
 	if limit == 0 {
 		return
 	}
@@ -146,8 +162,8 @@ func (l *SortedList) RangeReverseLimit(limit int ,fn func(Item) bool) {
 	defer l.l.RUnlock()
 
 	count := 0
-	for i := l.right; i>=l.left; i-- {
-		for j:=len(l.buckets[i].buckets)-1; j>=0; j-- {
+	for i := l.right; i >= l.left; i-- {
+		for j := len(l.buckets[i].buckets) - 1; j >= 0; j-- {
 			for it := range l.buckets[i].buckets[j] {
 				if !fn(it) {
 					return
@@ -216,4 +232,3 @@ func (l *SortedList) getKeyMapKey(data Item) (key1, key2 int, ok bool) {
 func (l *SortedList) deleteKeyMapKey(data Item) {
 	delete(l.keyMap, data)
 }
-
diff --git a/pkg/structure/syncmap/syncmap.go b/pkg/structure/syncmap/syncmap.go
index 619a535d..4ce6f8c0 100644
--- a/pkg/structure/syncmap/syncmap.go
+++ b/pkg/structure/syncmap/syncmap.go
@@ -1,3 +1,18 @@
+/*
+ *     Copyright 2020 The Dragonfly Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 package syncmap
 
@@ -65,7 +80,7 @@ func (mmap *SyncMap) GetAsMap(key string) (*SyncMap, error) {
 
 // GetAsList returns result as list
 // The ErrConvertFailed error will be returned if the assertion fails.
-func (mmap *SyncMap) GetAsList(key string)(*list.List, error)  {
+func (mmap *SyncMap) GetAsList(key string) (*list.List, error) {
 	v, err := mmap.Get(key)
 	if err != nil {
 		return list.New(), errors.Wrapf(err, "failed to get key %s from map", key)
@@ -75,6 +90,7 @@ func (mmap *SyncMap) GetAsList(key string)(*list.List, error)  {
 	}
 	return nil, errors.Wrapf(dferrors.ErrConvertFailed, "failed to get key %s from map with value %s", key, v)
 }
+
 // GetAsInt returns result as int.
 // The ErrConvertFailed error will be returned if the assertion fails.
 func (mmap *SyncMap) GetAsInt(key string) (int, error) {
diff --git a/pkg/structure/workqueue/delaying_queue.go b/pkg/structure/workqueue/delaying_queue.go
index 334a0717..a3c9a22f 100644
--- a/pkg/structure/workqueue/delaying_queue.go
+++ b/pkg/structure/workqueue/delaying_queue.go
@@ -1,10 +1,27 @@
+/*
+ *     Copyright 2020 The Dragonfly Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package workqueue
 
 import (
 	"container/heap"
-	"k8s.io/client-go/util/workqueue"
 	"time"
 
+	"k8s.io/client-go/util/workqueue"
+
 	"k8s.io/apimachinery/pkg/util/clock"
 	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
 )
diff --git a/pkg/synclock/count_rwmutex.go b/pkg/synclock/count_rwmutex.go
index 258ca25e..03e8f238 100644
--- a/pkg/synclock/count_rwmutex.go
+++ b/pkg/synclock/count_rwmutex.go
@@ -17,8 +17,9 @@
 package synclock
 
 import (
-	"d7y.io/dragonfly/v2/pkg/structure/atomiccount"
 	"sync"
+
+	"d7y.io/dragonfly/v2/pkg/structure/atomiccount"
 )
 
 type countRWMutex struct {
diff --git a/pkg/util/assertutils/asserts.go b/pkg/util/assertutils/asserts.go
index c8b0b56a..07bc750e 100644
--- a/pkg/util/assertutils/asserts.go
+++ b/pkg/util/assertutils/asserts.go
@@ -24,33 +24,33 @@ import (
 func AssertTrue(cond bool, message string) error {
 	if cond {
 		return nil
-	} else {
-		return errors.New(message)
 	}
+
+	return errors.New(message)
 }
 
 func AssertFalse(cond bool, message string) error {
 	if !cond {
 		return nil
-	} else {
-		return errors.New(message)
 	}
+
+	return errors.New(message)
 }
 
 func AssertNil(v interface{}, message string) error {
 	if ifaceutils.IsNil(v) {
 		return nil
-	} else {
-		return errors.New(message)
 	}
+
+	return errors.New(message)
 }
 
 func AssertNotNil(v interface{}, message string) error {
 	if !ifaceutils.IsNil(v) {
 		return nil
-	} else {
-		return errors.New(message)
 	}
+
+	return errors.New(message)
 }
 
 func PAssert(cond bool, message string) {
diff --git a/pkg/util/fileutils/file_utils.go b/pkg/util/fileutils/file_utils.go
index 3c162c81..0071533b 100644
--- a/pkg/util/fileutils/file_utils.go
+++ b/pkg/util/fileutils/file_utils.go
@@ -86,12 +86,12 @@ func IsSymbolicLink(name string) bool {
 	if e != nil {
 		return false
 	}
-	return f.Mode() & os.ModeSymlink != 0
+	return f.Mode()&os.ModeSymlink != 0
 }
 
 // SymbolicLink creates newname as a symbolic link to oldname.
 func SymbolicLink(oldname string, newname string) error {
-	if PathExist(newname) && IsSymbolicLink(newname) && PathExist(oldname){
+	if PathExist(newname) && IsSymbolicLink(newname) && PathExist(oldname) {
 		dstPath, err := os.Readlink(newname)
 		if err != nil {
 			return err
@@ -211,4 +211,4 @@ func MoveFile(src string, dst string) error {
 		}
 	}
 	return os.Rename(src, dst)
-}
\ No newline at end of file
+}
diff --git a/pkg/util/httputils/http_utils.go b/pkg/util/httputils/http_utils.go
index 039e5139..dff90126 100644
--- a/pkg/util/httputils/http_utils.go
+++ b/pkg/util/httputils/http_utils.go
@@ -20,11 +20,8 @@ import (
 	"context"
 	"crypto/tls"
 	"crypto/x509"
-	"d7y.io/dragonfly/v2/cdnsystem/cdnerrors"
 	"encoding/json"
 	"fmt"
-	"github.com/pkg/errors"
-	"github.com/valyala/fasthttp"
 	"io"
 	"io/ioutil"
 	"net"
@@ -33,6 +30,10 @@ import (
 	"strings"
 	"sync"
 	"time"
+
+	"d7y.io/dragonfly/v2/cdnsystem/cdnerrors"
+	"github.com/pkg/errors"
+	"github.com/valyala/fasthttp"
 )
 
 /* http content types */
diff --git a/pkg/util/net/iputils/ip_utils.go b/pkg/util/net/iputils/ip_utils.go
index 66b6b5c2..57f44417 100644
--- a/pkg/util/net/iputils/ip_utils.go
+++ b/pkg/util/net/iputils/ip_utils.go
@@ -24,7 +24,7 @@ import (
 	"github.com/pkg/errors"
 )
 
-var HostIp string
+var HostIP string
 var HostName string
 
 func init() {
@@ -32,7 +32,7 @@ func init() {
 	if ip == "" {
 		panic(err)
 	} else {
-		HostIp = ip
+		HostIP = ip
 	}
 
 	name, err := os.Hostname()
@@ -77,9 +77,9 @@ func externalIPv4() (string, error) {
 	if len(values) > 0 {
 		sort.Strings(values)
 		return values[0], nil
-	} else {
-		return "", errors.Errorf("not found any ipv4")
 	}
+
+	return "", errors.Errorf("not found any ipv4")
 }
 
 // ipAddrs returns all the valid IPs available.
diff --git a/pkg/util/statutils/stat_darwin.go b/pkg/util/statutils/stat_darwin.go
index c37472af..fc4027ea 100644
--- a/pkg/util/statutils/stat_darwin.go
+++ b/pkg/util/statutils/stat_darwin.go
@@ -52,9 +52,8 @@ func CtimeSec(info os.FileInfo) int64 {
 func GetSysStat(info os.FileInfo) *syscall.Stat_t {
 	if stat, ok := info.Sys().(*syscall.Stat_t); ok {
 		return stat
-	} else {
-		return nil
 	}
+	return nil
 }
 
 func FreeSpace(diskPath string) (unit.Bytes, error) {
diff --git a/scheduler/manager/cdn_manager.go b/scheduler/manager/cdn_manager.go
index 81fb55a6..6a90a55a 100644
--- a/scheduler/manager/cdn_manager.go
+++ b/scheduler/manager/cdn_manager.go
@@ -243,8 +243,8 @@ func (cm *CDNManager) Work(task *types.Task, stream *client.PieceSeedStream) {
 }
 
 func (cm *CDNManager) processPieceSeed(task *types.Task, ps *cdnsystem.PieceSeed) (err error) {
-	hostId := cm.getHostUuid(ps)
-	host, ok := cm.hostManager.Get(hostId)
+	hostID := cm.getHostUUID(ps)
+	host, ok := cm.hostManager.Get(hostID)
 	if !ok {
 		server, found := cm.getServer(ps.SeederName)
 		if !found {
@@ -254,7 +254,7 @@ func (cm *CDNManager) processPieceSeed(task *types.Task, ps *cdnsystem.PieceSeed
 		host = &types.Host{
 			Type: types.HostTypeCdn,
 			PeerHost: scheduler.PeerHost{
-				Uuid:     hostId,
+				Uuid:     hostID,
 				HostName: ps.SeederName,
 				Ip:       server.HostInfo.Ip,
 				RpcPort:  server.RpcPort,
@@ -316,7 +316,7 @@ func (cm *CDNManager) processPieceSeed(task *types.Task, ps *cdnsystem.PieceSeed
 	return
 }
 
-func (cm *CDNManager) getHostUuid(ps *cdnsystem.PieceSeed) string {
+func (cm *CDNManager) getHostUUID(ps *cdnsystem.PieceSeed) string {
 	return fmt.Sprintf("cdn:%s", ps.PeerId)
 }
 
diff --git a/scheduler/manager/task_manager.go b/scheduler/manager/task_manager.go
index 52d7bb36..05df37b2 100644
--- a/scheduler/manager/task_manager.go
+++ b/scheduler/manager/task_manager.go
@@ -138,17 +138,17 @@ func (m *TaskManager) gcWorkingLoop() {
 			}()
 			var needDeleteKeys []string
 			m.lock.RLock()
-			for taskId, task := range m.data {
+			for taskID, task := range m.data {
 				if task != nil && time.Now().After(task.LastActive.Add(m.gcDelayTime)) {
-					needDeleteKeys = append(needDeleteKeys, taskId)
+					needDeleteKeys = append(needDeleteKeys, taskID)
 					task.Removed = true
 				}
 			}
 			m.lock.RUnlock()
 
 			if len(needDeleteKeys) > 0 {
-				for _, taskId := range needDeleteKeys {
-					m.Delete(taskId)
+				for _, taskID := range needDeleteKeys {
+					m.Delete(taskID)
 				}
 			}
 
diff --git a/scheduler/metrics/task_statistic.go b/scheduler/metrics/task_statistic.go
index 3d5ad00b..ece308d5 100644
--- a/scheduler/metrics/task_statistic.go
+++ b/scheduler/metrics/task_statistic.go
@@ -22,20 +22,20 @@ import (
 )
 
 type TaskStatistic struct {
-	lock      sync.RWMutex
-	StartTime time.Time
-	EndTime time.Time
-	PeerCount int32
+	lock          sync.RWMutex
+	StartTime     time.Time
+	EndTime       time.Time
+	PeerCount     int32
 	FinishedCount int32
-	CostList []int32
+	CostList      []int32
 }
 
 type StatisticInfo struct {
-	StartTime time.Time
-	EndTime time.Time
-	PeerCount int32
+	StartTime     time.Time
+	EndTime       time.Time
+	PeerCount     int32
 	FinishedCount int32
-	Costs map[int32]int32
+	Costs         map[int32]int32
 }
 
 func (t *TaskStatistic) SetStartTime(start time.Time) {
@@ -52,7 +52,7 @@ func (t *TaskStatistic) SetEndTime(end time.Time) {
 
 func (t *TaskStatistic) AddPeerTaskStart() {
 	t.lock.Lock()
-	t.PeerCount ++
+	t.PeerCount++
 	t.lock.Unlock()
 }
 
@@ -66,11 +66,11 @@ func (t *TaskStatistic) GetStatistic() (info *StatisticInfo) {
 	t.lock.RLock()
 	defer t.lock.RUnlock()
 	info = &StatisticInfo{
-		StartTime: t.StartTime,
-		EndTime: t.EndTime,
-		PeerCount: t.PeerCount,
+		StartTime:     t.StartTime,
+		EndTime:       t.EndTime,
+		PeerCount:     t.PeerCount,
 		FinishedCount: t.FinishedCount,
-		Costs: make(map[int32]int32),
+		Costs:         make(map[int32]int32),
 	}
 
 	if info.EndTime.IsZero() {
@@ -79,7 +79,7 @@ func (t *TaskStatistic) GetStatistic() (info *StatisticInfo) {
 
 	count := len(t.CostList)
 	count90 := count * 90 / 100
-	count95 := count * 95 /100
+	count95 := count * 95 / 100
 
 	totalCost := int64(0)
 
@@ -97,4 +97,4 @@ func (t *TaskStatistic) GetStatistic() (info *StatisticInfo) {
 	}
 
 	return
-}
\ No newline at end of file
+}
diff --git a/scheduler/scheduler/scheduler.go b/scheduler/scheduler/scheduler.go
index 317faf05..103892c9 100644
--- a/scheduler/scheduler/scheduler.go
+++ b/scheduler/scheduler/scheduler.go
@@ -151,12 +151,12 @@ func (s *Scheduler) ScheduleBadNode(peer *types.PeerTask) (adjustNodes []*types.
 	adjustNodes = append(adjustNodes, peer)
 
 	for _, node := range adjustNodes {
-		parentId := ""
+		parentID := ""
 		if node.GetParent() != nil {
-			parentId = node.GetParent().DstPeerTask.Pid
+			parentID = node.GetParent().DstPeerTask.Pid
 		}
 		logger.Debugf("[%s][%s]SchedulerBadNode [%s] scheduler a new parent [%s]", peer.Task.TaskId, peer.Pid,
-			node.Pid, parentId)
+			node.Pid, parentID)
 	}
 
 	return
diff --git a/scheduler/server/scheduler_server.go b/scheduler/server/scheduler_server.go
index 700ed371..26b0ab54 100644
--- a/scheduler/server/scheduler_server.go
+++ b/scheduler/server/scheduler_server.go
@@ -132,8 +132,8 @@ func (s *SchedulerServer) RegisterPeerTask(ctx context.Context, request *schedul
 	}
 
 	// get or create host
-	hostId := request.PeerHost.Uuid
-	host, _ := s.service.GetHost(hostId)
+	hostID := request.PeerHost.Uuid
+	host, _ := s.service.GetHost(hostID)
 	if host == nil {
 		host = &types.Host{
 			Type:     types.HostTypePeer,
diff --git a/scheduler/server/server.go b/scheduler/server/server.go
index 955b2153..2fa9babf 100644
--- a/scheduler/server/server.go
+++ b/scheduler/server/server.go
@@ -117,7 +117,7 @@ func (s *Server) Serve() error {
 	}
 
 	logger.Infof("start server at port %d", port)
-	if err := rpc.StartTcpServer(port, port, s.server); err != nil {
+	if err := rpc.StartTCPServer(port, port, s.server); err != nil {
 		return err
 	}
 	return nil
diff --git a/scheduler/service/schedule_worker/worker_group.go b/scheduler/service/schedule_worker/worker_group.go
index 41f8edb0..6b1e5bc3 100644
--- a/scheduler/service/schedule_worker/worker_group.go
+++ b/scheduler/service/schedule_worker/worker_group.go
@@ -96,14 +96,14 @@ func (wg *WorkerGroup) ReceiveJob(job *types.PeerTask) {
 	if job == nil {
 		return
 	}
-	choiceWorkerId := crc32.ChecksumIEEE([]byte(job.Task.TaskId)) % uint32(wg.workerNum)
-	wg.workerList[choiceWorkerId].ReceiveJob(job)
+	choiceWorkerID := crc32.ChecksumIEEE([]byte(job.Task.TaskId)) % uint32(wg.workerNum)
+	wg.workerList[choiceWorkerID].ReceiveJob(job)
 }
 
 func (wg *WorkerGroup) ReceiveUpdatePieceResult(pr *scheduler2.PieceResult) {
 	if pr == nil {
 		return
 	}
-	choiceWorkerId := crc32.ChecksumIEEE([]byte(pr.SrcPid)) % uint32(wg.workerNum)
-	wg.workerList[choiceWorkerId].ReceiveUpdatePieceResult(pr)
+	choiceWorkerID := crc32.ChecksumIEEE([]byte(pr.SrcPid)) % uint32(wg.workerNum)
+	wg.workerList[choiceWorkerID].ReceiveUpdatePieceResult(pr)
 }
diff --git a/scheduler/types/client.go b/scheduler/types/client.go
index cc7272bc..db33cf84 100644
--- a/scheduler/types/client.go
+++ b/scheduler/types/client.go
@@ -18,9 +18,9 @@ package types
 
 import "d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 
-type IClient interface{
+type IClient interface {
 	Send(*scheduler.PeerPacket) error
 	Recv() (*scheduler.PieceResult, error)
 	Close()
 	IsClosed() bool
-}
\ No newline at end of file
+}
diff --git a/scheduler/types/host.go b/scheduler/types/host.go
index f17d7978..183d82df 100644
--- a/scheduler/types/host.go
+++ b/scheduler/types/host.go
@@ -17,9 +17,10 @@
 package types
 
 import (
+	"sync"
+
 	logger "d7y.io/dragonfly/v2/pkg/dflog"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
-	"sync"
 )
 
 type HostType int
@@ -55,11 +56,11 @@ func (h *Host) AddPeerTask(peerTask *PeerTask) {
 	h.peerTaskMap.Store(peerTask.Pid, peerTask)
 }
 
-func (h *Host) DeletePeerTask(peerTaskId string) {
+func (h *Host) DeletePeerTask(peerTaskID string) {
 	if h == nil || h.peerTaskMap == nil {
 		return
 	}
-	h.peerTaskMap.Delete(peerTaskId)
+	h.peerTaskMap.Delete(peerTaskID)
 }
 
 func (h *Host) GetPeerTaskNum() int32 {
@@ -73,8 +74,8 @@ func (h *Host) GetPeerTaskNum() int32 {
 	return int32(count)
 }
 
-func (h *Host) GetPeerTask(peerTaskId string) (peerTask *PeerTask) {
-	v, _ := h.peerTaskMap.Load(peerTaskId)
+func (h *Host) GetPeerTask(peerTaskID string) (peerTask *PeerTask) {
+	v, _ := h.peerTaskMap.Load(peerTaskID)
 	peerTask, _ = v.(*PeerTask)
 	return
 }
diff --git a/scheduler/types/peer_task.go b/scheduler/types/peer_task.go
index 7d032a5f..4de344fd 100644
--- a/scheduler/types/peer_task.go
+++ b/scheduler/types/peer_task.go
@@ -17,14 +17,15 @@
 package types
 
 import (
-	"d7y.io/dragonfly/v2/pkg/dfcodes"
-	"d7y.io/dragonfly/v2/pkg/dferrors"
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
-	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 	"errors"
 	"sync"
 	"sync/atomic"
 	"time"
+
+	"d7y.io/dragonfly/v2/pkg/dfcodes"
+	"d7y.io/dragonfly/v2/pkg/dferrors"
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
+	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 )
 
 type PeerTaskStatus int8
@@ -443,11 +444,12 @@ func (pt *PeerTask) SetNodeStatus(status PeerTaskStatus, data ...interface{}) {
 }
 
 func (pt *PeerTask) IsWaiting() bool {
-	pt.lock.Lock()
-	defer pt.lock.Unlock()
 	if pt == nil || pt.parent == nil || pt.parent.DstPeerTask == nil {
 		return false
 	}
+
+	pt.lock.Lock()
+	defer pt.lock.Unlock()
 	return pt.finishedNum >= pt.parent.DstPeerTask.finishedNum
 }
 
diff --git a/scheduler/types/task.go b/scheduler/types/task.go
index 837c932a..77a16130 100644
--- a/scheduler/types/task.go
+++ b/scheduler/types/task.go
@@ -17,12 +17,13 @@
 package types
 
 import (
+	"sync"
+	"time"
+
 	"d7y.io/dragonfly/v2/pkg/dferrors"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 	"d7y.io/dragonfly/v2/scheduler/metrics"
-	"sync"
-	"time"
 )
 
 type Task struct {
diff --git a/version/platform_darwin.go b/version/platform_darwin.go
index 271c9d98..e8d28bbf 100644
--- a/version/platform_darwin.go
+++ b/version/platform_darwin.go
@@ -18,4 +18,4 @@ package version
 
 const (
 	osArch = "darwin"
-)
\ No newline at end of file
+)


Test patch:
diff --git a/cdnsystem/cdnerrors/errors_test.go b/cdnsystem/cdnerrors/errors_test.go
index ab4655df..168ec103 100644
--- a/cdnsystem/cdnerrors/errors_test.go
+++ b/cdnsystem/cdnerrors/errors_test.go
@@ -475,13 +475,13 @@ func (s *ErrorTestSuite) TestIsTaskIDDuplicate() {
 		{
 			name: "equal",
 			args: args{
-				err: ErrTaskIdDuplicate,
+				err: ErrTaskIDDuplicate,
 			},
 			want: true,
 		}, {
 			name: "wrap",
 			args: args{
-				err: errors.Wrapf(errors.Wrapf(ErrTaskIdDuplicate, "wrap err"), "wapp err"),
+				err: errors.Wrapf(errors.Wrapf(ErrTaskIDDuplicate, "wrap err"), "wapp err"),
 			},
 			want: true,
 		}, {
diff --git a/cdnsystem/storedriver/local/local_driver_test.go b/cdnsystem/storedriver/local/local_driver_test.go
index 3d35a2ce..2556853e 100644
--- a/cdnsystem/storedriver/local/local_driver_test.go
+++ b/cdnsystem/storedriver/local/local_driver_test.go
@@ -18,7 +18,6 @@ package local
 
 import (
 	"context"
-	"fmt"
 	"io"
 	"io/ioutil"
 	"os"
@@ -63,9 +62,7 @@ func (s *StorageTestSuite) SetupSuite() {
 
 func (s *StorageTestSuite) TeardownSuite() {
 	if s.workHome != "" {
-		if err := os.RemoveAll(s.workHome); err != nil {
-			fmt.Errorf("remove path:%s error", s.workHome)
-		}
+		os.RemoveAll(s.workHome)
 	}
 }
 
@@ -535,9 +532,7 @@ func (s *StorageTestSuite) TestRemove() {
 		args    args
 		wantErr bool
 	}{
-		{
-
-		},
+		{},
 	}
 	for _, tt := range tests {
 		err := s.Remove(tt.args.ctx, tt.args.raw)
@@ -560,9 +555,7 @@ func (s *StorageTestSuite) TestStat() {
 		want    *storedriver.StorageInfo
 		wantErr bool
 	}{
-		{
-
-		},
+		{},
 	}
 	for _, tt := range tests {
 		got, err := s.Stat(tt.args.ctx, tt.args.raw)
diff --git a/client/daemon/peer/piece_manager_test.go b/client/daemon/peer/piece_manager_test.go
index b3b7daed..388a7bf4 100644
--- a/client/daemon/peer/piece_manager_test.go
+++ b/client/daemon/peer/piece_manager_test.go
@@ -182,7 +182,7 @@ func TestPieceManager_DownloadSource(t *testing.T) {
 			request := &scheduler.PeerTaskRequest{
 				Url: ts.URL,
 				UrlMata: &base.UrlMeta{
-					Digest:    "",
+					Digest: "",
 					Range:  "",
 					Header: nil,
 				},
diff --git a/client/daemon/proxy/proxy_test.go b/client/daemon/proxy/proxy_test.go
index 6b957a9a..943c8d2d 100644
--- a/client/daemon/proxy/proxy_test.go
+++ b/client/daemon/proxy/proxy_test.go
@@ -56,15 +56,15 @@ func (tc *testCase) WithRule(regx string, direct bool, useHTTPS bool, redirect s
 	return tc
 }
 
-func (tc *testCase) WithRegistryMirror(rawUrl string, direct bool) *testCase {
+func (tc *testCase) WithRegistryMirror(rawURL string, direct bool) *testCase {
 	if tc.Error != nil {
 		return tc
 	}
 
 	var url *url.URL
-	url, tc.Error = url.Parse(rawUrl)
+	url, tc.Error = url.Parse(rawURL)
 	tc.RegistryMirror = &config.RegistryMirror{
-		Remote: &config.URL{url},
+		Remote: &config.URL{URL: url},
 		Direct: direct,
 	}
 	return tc
diff --git a/client/daemon/service/manager_test.go b/client/daemon/service/manager_test.go
index 932b5a8a..116f9931 100644
--- a/client/daemon/service/manager_test.go
+++ b/client/daemon/service/manager_test.go
@@ -21,6 +21,7 @@ import (
 	"fmt"
 	"io"
 	"net"
+	"os"
 	"testing"
 	"time"
 
@@ -42,7 +43,7 @@ import (
 )
 
 func TestMain(m *testing.M) {
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestDownloadManager_ServeDownload(t *testing.T) {
@@ -79,6 +80,10 @@ func TestDownloadManager_ServeDownload(t *testing.T) {
 	}
 	m.downloadServer = rpc.NewServer(m)
 	port, err := freeport.GetFreePort()
+	if err != nil {
+		t.Fatal(err)
+	}
+
 	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
 	assert.Nil(err, "get free port should be ok")
 	go func() {
@@ -156,6 +161,10 @@ func TestDownloadManager_ServePeer(t *testing.T) {
 	}
 	m.peerServer = rpc.NewServer(m)
 	port, err := freeport.GetFreePort()
+	if err != nil {
+		t.Fatal(err)
+	}
+
 	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
 	assert.Nil(err, "get free port should be ok")
 	go func() {
diff --git a/client/daemon/storage/local_storage_test.go b/client/daemon/storage/local_storage_test.go
index b8fec5e2..e9b2aef8 100644
--- a/client/daemon/storage/local_storage_test.go
+++ b/client/daemon/storage/local_storage_test.go
@@ -42,7 +42,7 @@ import (
 )
 
 func TestMain(m *testing.M) {
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestLocalTaskStore_PutAndGetPiece_Simple(t *testing.T) {
@@ -66,6 +66,10 @@ func TestLocalTaskStore_PutAndGetPiece_Simple(t *testing.T) {
 			},
 		}, func(request CommonTaskRequest) {
 		})
+	if err != nil {
+		t.Fatal(err)
+	}
+
 	var s = sm.(*storageManager)
 
 	err = s.CreateTask(
@@ -236,6 +240,10 @@ func TestLocalTaskStore_PutAndGetPiece_Advance(t *testing.T) {
 			},
 		}, func(request CommonTaskRequest) {
 		})
+	if err != nil {
+		t.Fatal(err)
+	}
+
 	var s = sm.(*storageManager)
 
 	err = s.CreateTask(
diff --git a/client/daemon/transport/transport_test.go b/client/daemon/transport/transport_test.go
index ad9d9970..a0995c87 100644
--- a/client/daemon/transport/transport_test.go
+++ b/client/daemon/transport/transport_test.go
@@ -22,6 +22,7 @@ import (
 	"io"
 	"io/ioutil"
 	"net/http"
+	"os"
 	"testing"
 
 	"github.com/golang/mock/gomock"
@@ -33,7 +34,7 @@ import (
 )
 
 func TestMain(m *testing.M) {
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestTransport_RoundTrip(t *testing.T) {
diff --git a/client/daemon/upload/upload_manager_test.go b/client/daemon/upload/upload_manager_test.go
index cd8f4a12..55185fd7 100644
--- a/client/daemon/upload/upload_manager_test.go
+++ b/client/daemon/upload/upload_manager_test.go
@@ -24,6 +24,7 @@ import (
 	"io/ioutil"
 	"net"
 	"net/http"
+	"os"
 	"testing"
 
 	"github.com/golang/mock/gomock"
@@ -37,7 +38,7 @@ import (
 )
 
 func TestMain(m *testing.M) {
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestUploadManager_Serve(t *testing.T) {
diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go
index 8b20f070..0b02db22 100644
--- a/pkg/cache/cache_test.go
+++ b/pkg/cache/cache_test.go
@@ -26,6 +26,13 @@ import (
 	"time"
 )
 
+var (
+	v1 = "foo"
+	v2 = "bar"
+	v3 = "baz"
+	v4 = "yes"
+)
+
 type TestStruct struct {
 	Num      int
 	Children []*TestStruct
@@ -124,15 +131,15 @@ func TestCacheTimes(t *testing.T) {
 
 func TestStorePointerToStruct(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", &TestStruct{Num: 1}, DefaultExpiration)
-	x, found := tc.Get("foo")
+	tc.Set(v1, &TestStruct{Num: 1}, DefaultExpiration)
+	x, found := tc.Get(v1)
 	if !found {
 		t.Fatal("*TestStruct was not found for foo")
 	}
 	foo := x.(*TestStruct)
 	foo.Num++
 
-	y, found := tc.Get("foo")
+	y, found := tc.Get(v1)
 	if !found {
 		t.Fatal("*TestStruct was not found for foo (second time)")
 	}
@@ -144,11 +151,11 @@ func TestStorePointerToStruct(t *testing.T) {
 
 func TestAdd(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	err := tc.Add("foo", "bar", DefaultExpiration)
+	err := tc.Add(v1, v2, DefaultExpiration)
 	if err != nil {
 		t.Error("Couldn't add foo even though it shouldn't exist")
 	}
-	err = tc.Add("foo", "baz", DefaultExpiration)
+	err = tc.Add(v1, v3, DefaultExpiration)
 	if err == nil {
 		t.Error("Successfully added another foo when it should have returned an error")
 	}
@@ -156,9 +163,9 @@ func TestAdd(t *testing.T) {
 
 func TestDelete(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", "bar", DefaultExpiration)
-	tc.Delete("foo")
-	x, found := tc.Get("foo")
+	tc.Set(v1, v2, DefaultExpiration)
+	tc.Delete(v1)
+	x, found := tc.Get(v1)
 	if found {
 		t.Error("foo was found, but it should have been deleted")
 	}
@@ -169,9 +176,9 @@ func TestDelete(t *testing.T) {
 
 func TestCacheKeys(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", 1, DefaultExpiration)
-	tc.Set("bar", 2, DefaultExpiration)
-	tc.Set("baz", 3, DefaultExpiration)
+	tc.Set(v1, 1, DefaultExpiration)
+	tc.Set(v2, 2, DefaultExpiration)
+	tc.Set(v3, 3, DefaultExpiration)
 	keys := tc.Keys()
 	if len(keys) != 3 {
 		t.Error("invalid number of cache keys received")
@@ -180,9 +187,9 @@ func TestCacheKeys(t *testing.T) {
 
 func TestItemCount(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", "1", DefaultExpiration)
-	tc.Set("bar", "2", DefaultExpiration)
-	tc.Set("baz", "3", DefaultExpiration)
+	tc.Set(v1, "1", DefaultExpiration)
+	tc.Set(v2, "2", DefaultExpiration)
+	tc.Set(v3, "3", DefaultExpiration)
 	if n := tc.ItemCount(); n != 3 {
 		t.Errorf("Item count is not 3: %d", n)
 	}
@@ -190,17 +197,17 @@ func TestItemCount(t *testing.T) {
 
 func TestFlush(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", "bar", DefaultExpiration)
-	tc.Set("baz", "yes", DefaultExpiration)
+	tc.Set(v1, v2, DefaultExpiration)
+	tc.Set(v3, v4, DefaultExpiration)
 	tc.Flush()
-	x, found := tc.Get("foo")
+	x, found := tc.Get(v1)
 	if found {
 		t.Error("foo was found, but it should have been deleted")
 	}
 	if x != nil {
 		t.Error("x is not nil:", x)
 	}
-	x, found = tc.Get("baz")
+	x, found = tc.Get(v3)
 	if found {
 		t.Error("baz was found, but it should have been deleted")
 	}
@@ -211,16 +218,16 @@ func TestFlush(t *testing.T) {
 
 func TestOnEvicted(t *testing.T) {
 	tc := New(DefaultExpiration, 0)
-	tc.Set("foo", 3, DefaultExpiration)
+	tc.Set(v1, 3, DefaultExpiration)
 	works := false
 	tc.OnEvicted(func(k string, v interface{}) {
-		if k == "foo" && v.(int) == 3 {
+		if k == v1 && v.(int) == 3 {
 			works = true
 		}
-		tc.Set("bar", 4, DefaultExpiration)
+		tc.Set(v2, 4, DefaultExpiration)
 	})
-	tc.Delete("foo")
-	x, _ := tc.Get("bar")
+	tc.Delete(v1)
+	x, _ := tc.Get(v2)
 	if !works {
 		t.Error("works bool not true")
 	}
@@ -248,17 +255,6 @@ func testFillAndSerialize(t *testing.T, tc Cache) {
 		{Num: 2},
 		{Num: 3},
 	}, DefaultExpiration)
-	tc.Set("[]*struct", []*TestStruct{
-		&TestStruct{Num: 4},
-		&TestStruct{Num: 5},
-	}, DefaultExpiration)
-	tc.Set("structception", &TestStruct{
-		Num: 42,
-		Children: []*TestStruct{
-			&TestStruct{Num: 6174},
-			&TestStruct{Num: 4716},
-		},
-	}, DefaultExpiration)
 
 	fp := &bytes.Buffer{}
 	err := tc.Save(fp)
@@ -388,32 +384,32 @@ func BenchmarkCacheGetNotExpiring(b *testing.B) {
 func benchmarkCacheGet(b *testing.B, exp time.Duration) {
 	b.StopTimer()
 	tc := New(exp, 0)
-	tc.Set("foo", "bar", DefaultExpiration)
+	tc.Set(v1, v2, DefaultExpiration)
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
-		tc.Get("foo")
+		tc.Get(v1)
 	}
 }
 
 func BenchmarkRWMutexMapGet(b *testing.B) {
 	b.StopTimer()
 	m := map[string]string{
-		"foo": "bar",
+		v1: v2,
 	}
 	mu := sync.RWMutex{}
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
 		mu.RLock()
-		_, _ = m["foo"]
+		_, _ = m[v1]
 		mu.RUnlock()
 	}
 }
 
 func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) {
 	b.StopTimer()
-	s := struct{ name string }{name: "foo"}
+	s := struct{ name string }{name: v1}
 	m := map[interface{}]string{
-		s: "bar",
+		s: v2,
 	}
 	mu := sync.RWMutex{}
 	b.StartTimer()
@@ -427,13 +423,13 @@ func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) {
 func BenchmarkRWMutexInterfaceMapGetString(b *testing.B) {
 	b.StopTimer()
 	m := map[interface{}]string{
-		"foo": "bar",
+		v1: v2,
 	}
 	mu := sync.RWMutex{}
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
 		mu.RLock()
-		_, _ = m["foo"]
+		_, _ = m[v1]
 		mu.RUnlock()
 	}
 }
@@ -449,7 +445,7 @@ func BenchmarkCacheGetConcurrentNotExpiring(b *testing.B) {
 func benchmarkCacheGetConcurrent(b *testing.B, exp time.Duration) {
 	b.StopTimer()
 	tc := New(exp, 0)
-	tc.Set("foo", "bar", DefaultExpiration)
+	tc.Set(v1, v2, DefaultExpiration)
 	wg := new(sync.WaitGroup)
 	workers := runtime.NumCPU()
 	each := b.N / workers
@@ -458,7 +454,7 @@ func benchmarkCacheGetConcurrent(b *testing.B, exp time.Duration) {
 	for i := 0; i < workers; i++ {
 		go func() {
 			for j := 0; j < each; j++ {
-				tc.Get("foo")
+				tc.Get(v1)
 			}
 			wg.Done()
 		}()
@@ -469,7 +465,7 @@ func benchmarkCacheGetConcurrent(b *testing.B, exp time.Duration) {
 func BenchmarkRWMutexMapGetConcurrent(b *testing.B) {
 	b.StopTimer()
 	m := map[string]string{
-		"foo": "bar",
+		v1: v2,
 	}
 	mu := sync.RWMutex{}
 	wg := new(sync.WaitGroup)
@@ -481,7 +477,7 @@ func BenchmarkRWMutexMapGetConcurrent(b *testing.B) {
 		go func() {
 			for j := 0; j < each; j++ {
 				mu.RLock()
-				_, _ = m["foo"]
+				_, _ = m[v1]
 				mu.RUnlock()
 			}
 			wg.Done()
@@ -507,9 +503,9 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
 	tc := New(exp, 0)
 	keys := make([]string, n)
 	for i := 0; i < n; i++ {
-		k := "foo" + strconv.Itoa(i)
+		k := v1 + strconv.Itoa(i)
 		keys[i] = k
-		tc.Set(k, "bar", DefaultExpiration)
+		tc.Set(k, v2, DefaultExpiration)
 	}
 	each := b.N / n
 	wg := new(sync.WaitGroup)
@@ -539,7 +535,7 @@ func benchmarkCacheSet(b *testing.B, exp time.Duration) {
 	tc := New(exp, 0)
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
-		tc.Set("foo", "bar", DefaultExpiration)
+		tc.Set(v1, v2, DefaultExpiration)
 	}
 }
 
@@ -550,7 +546,7 @@ func BenchmarkRWMutexMapSet(b *testing.B) {
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
 		mu.Lock()
-		m["foo"] = "bar"
+		m[v1] = v2
 		mu.Unlock()
 	}
 }
@@ -560,8 +556,8 @@ func BenchmarkCacheSetDelete(b *testing.B) {
 	tc := New(DefaultExpiration, 0)
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
-		tc.Set("foo", "bar", DefaultExpiration)
-		tc.Delete("foo")
+		tc.Set(v1, v2, DefaultExpiration)
+		tc.Delete(v1)
 	}
 }
 
@@ -572,10 +568,10 @@ func BenchmarkRWMutexMapSetDelete(b *testing.B) {
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
 		mu.Lock()
-		m["foo"] = "bar"
+		m[v1] = v2
 		mu.Unlock()
 		mu.Lock()
-		delete(m, "foo")
+		delete(m, v1)
 		mu.Unlock()
 	}
 }
@@ -587,8 +583,8 @@ func BenchmarkRWMutexMapSetDeleteSingleLock(b *testing.B) {
 	b.StartTimer()
 	for i := 0; i < b.N; i++ {
 		mu.Lock()
-		m["foo"] = "bar"
-		delete(m, "foo")
+		m[v1] = v2
+		delete(m, v1)
 		mu.Unlock()
 	}
 }
diff --git a/pkg/ratelimiter/ratelimiter/ratelimiter_test.go b/pkg/ratelimiter/ratelimiter/ratelimiter_test.go
index 81bafc6d..f6d7994e 100644
--- a/pkg/ratelimiter/ratelimiter/ratelimiter_test.go
+++ b/pkg/ratelimiter/ratelimiter/ratelimiter_test.go
@@ -17,9 +17,10 @@
 package ratelimiter
 
 import (
-	"github.com/stretchr/testify/suite"
 	"testing"
 	"time"
+
+	"github.com/stretchr/testify/suite"
 )
 
 func TestSuite(t *testing.T) {
diff --git a/pkg/structure/atomiccount/atomiccount_test.go b/pkg/structure/atomiccount/atomiccount_test.go
index eb87e0c9..096048b7 100644
--- a/pkg/structure/atomiccount/atomiccount_test.go
+++ b/pkg/structure/atomiccount/atomiccount_test.go
@@ -17,15 +17,16 @@
 package atomiccount
 
 import (
-	"github.com/stretchr/testify/suite"
 	"testing"
+
+	"github.com/stretchr/testify/suite"
 )
 
 func TestSuite(t *testing.T) {
 	suite.Run(t, new(AtomicCountUtilSuite))
 }
 
-type AtomicCountUtilSuite struct{
+type AtomicCountUtilSuite struct {
 	suite.Suite
 }
 
diff --git a/pkg/structure/queue/lru_queue_test.go b/pkg/structure/queue/lru_queue_test.go
index 001f6d60..130c6f7c 100644
--- a/pkg/structure/queue/lru_queue_test.go
+++ b/pkg/structure/queue/lru_queue_test.go
@@ -17,8 +17,9 @@
 package queue
 
 import (
-	"github.com/stretchr/testify/suite"
 	"testing"
+
+	"github.com/stretchr/testify/suite"
 )
 
 func TestLruQueue(t *testing.T) {
@@ -70,47 +71,47 @@ func (suite *LruQueueTestSuite) TestLRUQueue() {
 
 	items = q.GetFront(10)
 	suite.Equal(len(items), 5)
-	suite.Equal(items[0],  "data5")
-	suite.Equal(items[1],  "data4")
-	suite.Equal(items[2],  "data3")
-	suite.Equal(items[3],  3)
-	suite.Equal(items[4],  2)
+	suite.Equal(items[0], "data5")
+	suite.Equal(items[1], "data4")
+	suite.Equal(items[2], "data3")
+	suite.Equal(items[3], 3)
+	suite.Equal(items[4], 2)
 
 	obsoleteKey, obsoleteData := q.Put("key6", "data6")
-	suite.Equal(obsoleteKey,  "key2")
-	suite.Equal(obsoleteData.(int),  2)
+	suite.Equal(obsoleteKey, "key2")
+	suite.Equal(obsoleteData.(int), 2)
 	_, err = q.GetItemByKey("key2")
 	suite.NotNil(err)
 
 	items = q.GetFront(5)
-	suite.Equal(len(items),  5)
-	suite.Equal(items[0],  "data6")
-	suite.Equal(items[1],  "data5")
-	suite.Equal(items[2],  "data4")
-	suite.Equal(items[3],  "data3")
-	suite.Equal(items[4],  3)
+	suite.Equal(len(items), 5)
+	suite.Equal(items[0], "data6")
+	suite.Equal(items[1], "data5")
+	suite.Equal(items[2], "data4")
+	suite.Equal(items[3], "data3")
+	suite.Equal(items[4], 3)
 
 	v1, err = q.Get("key5")
 	suite.Nil(err)
-	suite.Equal(v1.(string),  "data5")
+	suite.Equal(v1.(string), "data5")
 
 	items = q.GetFront(5)
-	suite.Equal(len(items),  5)
-	suite.Equal(items[0],  "data5")
-	suite.Equal(items[1],  "data6")
-	suite.Equal(items[2],  "data4")
-	suite.Equal(items[3],  "data3")
-	suite.Equal(items[4],  3)
+	suite.Equal(len(items), 5)
+	suite.Equal(items[0], "data5")
+	suite.Equal(items[1], "data6")
+	suite.Equal(items[2], "data4")
+	suite.Equal(items[3], "data3")
+	suite.Equal(items[4], 3)
 
 	v1 = q.Delete("key3")
-	suite.Equal(v1,  "data3")
+	suite.Equal(v1, "data3")
 
 	items = q.GetFront(5)
-	suite.Equal(len(items),  4)
-	suite.Equal(items[0],  "data5")
-	suite.Equal(items[1],  "data6")
-	suite.Equal(items[2],  "data4")
-	suite.Equal(items[3],  3)
+	suite.Equal(len(items), 4)
+	suite.Equal(items[0], "data5")
+	suite.Equal(items[1], "data6")
+	suite.Equal(items[2], "data4")
+	suite.Equal(items[3], 3)
 
 	v1 = q.Delete("key3")
 	suite.Nil(v1)
diff --git a/pkg/structure/queue/queue_test.go b/pkg/structure/queue/queue_test.go
index 30e3159a..0847a962 100644
--- a/pkg/structure/queue/queue_test.go
+++ b/pkg/structure/queue/queue_test.go
@@ -17,12 +17,13 @@
 package queue
 
 import (
-	"github.com/stretchr/testify/suite"
 	"math/rand"
 	"sync"
 	"sync/atomic"
 	"testing"
 	"time"
+
+	"github.com/stretchr/testify/suite"
 )
 
 func TestQueue(t *testing.T) {
@@ -45,38 +46,38 @@ func (suite *QueueTestSuite) TestQueue_infiniteQueue() {
 	suite.Equal(q.Len(), 0)
 
 	q.PutTimeout(nil, 0)
-	suite.Equal(q.Len(),  0)
+	suite.Equal(q.Len(), 0)
 
 	q.Put(0)
-	suite.Equal(q.Len(),  1)
-	suite.Equal(q.Poll(),  0)
-	suite.Equal(q.Len(),  0)
+	suite.Equal(q.Len(), 1)
+	suite.Equal(q.Poll(), 0)
+	suite.Equal(q.Len(), 0)
 
 	{ // test Poll
 		time.AfterFunc(timeout, func() { q.Put(1) })
 		start := time.Now()
-		suite.Equal(q.Poll(),  1)
-		suite.Equal(time.Since(start) > timeout,  true)
+		suite.Equal(q.Poll(), 1)
+		suite.Equal(time.Since(start) > timeout, true)
 	}
 
 	{ // test PollTimeout
 		v, ok := q.PollTimeout(0)
 		suite.Nil(v)
-		suite.Equal(ok,  false)
+		suite.Equal(ok, false)
 
 		start := time.Now()
 		v, ok = q.PollTimeout(timeout)
 		suite.Nil(v)
-		suite.Equal(ok,  false)
-		suite.Equal(time.Since(start) > timeout,  true)
+		suite.Equal(ok, false)
+		suite.Equal(time.Since(start) > timeout, true)
 
 		time.AfterFunc(timeout/2, func() { q.Put(1) })
 		start = time.Now()
 		v, ok = q.PollTimeout(timeout)
-		suite.Equal(ok,  true)
-		suite.Equal(v,  1)
-		suite.Equal(time.Since(start) >= timeout/2,  true)
-		suite.Equal(time.Since(start) < timeout,  true)
+		suite.Equal(ok, true)
+		suite.Equal(v, 1)
+		suite.Equal(time.Since(start) >= timeout/2, true)
+		suite.Equal(time.Since(start) < timeout, true)
 	}
 }
 func (suite *QueueTestSuite) TestQueue_infiniteQueue_PollTimeout() {
@@ -104,8 +105,8 @@ func (suite *QueueTestSuite) TestQueue_infiniteQueue_PollTimeout() {
 	})
 	wg.Wait()
 
-	suite.Equal(time.Since(start) > timeout,  true)
-	suite.Equal(cnt,  int32(n-1))
+	suite.Equal(time.Since(start) > timeout, true)
+	suite.Equal(cnt, int32(n-1))
 }
 
 func (suite *QueueTestSuite) TestQueue_finiteQueue() {
@@ -113,46 +114,46 @@ func (suite *QueueTestSuite) TestQueue_finiteQueue() {
 	q := NewQueue(2)
 
 	q.Put(nil)
-	suite.Equal(q.Len(),  0)
+	suite.Equal(q.Len(), 0)
 
 	q.PutTimeout(nil, 0)
-	suite.Equal(q.Len(),  0)
+	suite.Equal(q.Len(), 0)
 
 	q.Put(1)
-	suite.Equal(q.Len(),  1)
+	suite.Equal(q.Len(), 1)
 
 	start := time.Now()
 	q.PutTimeout(2, timeout)
 	q.PutTimeout(3, timeout)
 	q.PutTimeout(4, 0)
-	suite.Equal(q.Len(),  2)
-	suite.Equal(time.Since(start) >= timeout,  true)
-	suite.Equal(time.Since(start) < 2*timeout,  true)
+	suite.Equal(q.Len(), 2)
+	suite.Equal(time.Since(start) >= timeout, true)
+	suite.Equal(time.Since(start) < 2*timeout, true)
 
-	suite.Equal(q.Poll(),  1)
-	suite.Equal(q.Len(),  1)
-	suite.Equal(q.Poll(),  2)
+	suite.Equal(q.Poll(), 1)
+	suite.Equal(q.Len(), 1)
+	suite.Equal(q.Poll(), 2)
 
 	{
 		q.PutTimeout(1, 0)
 		item, ok := q.PollTimeout(timeout)
-		suite.Equal(ok,  true)
-		suite.Equal(item,  1)
+		suite.Equal(ok, true)
+		suite.Equal(item, 1)
 
 		start = time.Now()
 		item, ok = q.PollTimeout(timeout)
-		suite.Equal(ok,  false)
+		suite.Equal(ok, false)
 		suite.Nil(item)
-		suite.Equal(time.Since(start) >= timeout,  true)
+		suite.Equal(time.Since(start) >= timeout, true)
 
 		start = time.Now()
 		q.PutTimeout(1, 0)
 		item, ok = q.PollTimeout(0)
-		suite.Equal(ok,  true)
-		suite.Equal(item,  1)
+		suite.Equal(ok, true)
+		suite.Equal(item, 1)
 		item, ok = q.PollTimeout(0)
-		suite.Equal(ok,  false)
+		suite.Equal(ok, false)
 		suite.Nil(item)
-		suite.Equal(time.Since(start) < timeout,  true)
+		suite.Equal(time.Since(start) < timeout, true)
 	}
 }
diff --git a/pkg/structure/sortedlist/sorted_list_test.go b/pkg/structure/sortedlist/sorted_list_test.go
index 46ae1f17..d04d904c 100644
--- a/pkg/structure/sortedlist/sorted_list_test.go
+++ b/pkg/structure/sortedlist/sorted_list_test.go
@@ -1,3 +1,19 @@
+/*
+ *     Copyright 2020 The Dragonfly Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package sortedlist
 
 import (
@@ -31,7 +47,7 @@ func TestAdd(t *testing.T) {
 
 func TestDelete(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -44,7 +60,7 @@ func TestDelete(t *testing.T) {
 
 func TestUpdate(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -52,14 +68,14 @@ func TestUpdate(t *testing.T) {
 	l.Update(it)
 	l.Add(newItem(2, 3))
 	key1, key2, ok := l.getKeyMapKey(it)
-	if l.Size() != 4 || key1 != 2 || key2 !=3 || !ok {
+	if l.Size() != 4 || key1 != 2 || key2 != 3 || !ok {
 		t.Errorf("TestUpdate failed count required[3] but get [%d]", l.Size())
 	}
 }
 
 func TestRange(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -67,12 +83,12 @@ func TestRange(t *testing.T) {
 	l.Update(it)
 	l.Add(newItem(2, 3))
 	key1, key2, ok := l.getKeyMapKey(it)
-	if l.Size() != 4 || key1 != 2 || key2 !=3 || !ok {
+	if l.Size() != 4 || key1 != 2 || key2 != 3 || !ok {
 		t.Errorf("TestUpdate failed count required[4] but get [%d]", l.Size())
 	}
 
 	count := 0
-	l.Range(func(data Item)bool {
+	l.Range(func(data Item) bool {
 		it := data.(*item)
 		fmt.Println(it.key1, it.key2)
 		count++
@@ -85,7 +101,7 @@ func TestRange(t *testing.T) {
 
 func TestRangeLimit(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -93,12 +109,12 @@ func TestRangeLimit(t *testing.T) {
 	l.Update(it)
 	l.Add(newItem(2, 3))
 	key1, key2, ok := l.getKeyMapKey(it)
-	if l.Size() != 4 || key1 != 2 || key2 !=3 || !ok {
+	if l.Size() != 4 || key1 != 2 || key2 != 3 || !ok {
 		t.Errorf("TestUpdate failed count required[4] but get [%d]", l.Size())
 	}
 
 	count := 0
-	l.RangeLimit(2, func(data Item)bool {
+	l.RangeLimit(2, func(data Item) bool {
 		it := data.(*item)
 		fmt.Println(it.key1, it.key2)
 		count++
@@ -111,7 +127,7 @@ func TestRangeLimit(t *testing.T) {
 
 func TestRangeReverse(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -119,12 +135,12 @@ func TestRangeReverse(t *testing.T) {
 	l.Update(it)
 	l.Add(newItem(2, 3))
 	key1, key2, ok := l.getKeyMapKey(it)
-	if l.Size() != 4 || key1 != 2 || key2 !=3 || !ok {
+	if l.Size() != 4 || key1 != 2 || key2 != 3 || !ok {
 		t.Errorf("TestRangeReverse failed count required[4] but get [%d]", l.Size())
 	}
 
 	count := 0
-	l.RangeReverse(func(data Item)bool {
+	l.RangeReverse(func(data Item) bool {
 		it := data.(*item)
 		fmt.Println(it.key1, it.key2)
 		count++
@@ -137,7 +153,7 @@ func TestRangeReverse(t *testing.T) {
 
 func TestRangeReverseLimit(t *testing.T) {
 	l := NewSortedList()
-	it := newItem(1,3)
+	it := newItem(1, 3)
 	l.Add(newItem(1, 2))
 	l.Add(newItem(2, 2))
 	l.Add(it)
@@ -145,12 +161,12 @@ func TestRangeReverseLimit(t *testing.T) {
 	l.Update(it)
 	l.Add(newItem(2, 3))
 	key1, key2, ok := l.getKeyMapKey(it)
-	if l.Size() != 4 || key1 != 2 || key2 !=3 || !ok {
+	if l.Size() != 4 || key1 != 2 || key2 != 3 || !ok {
 		t.Errorf("TestRangeReverseLimit failed count required[4] but get [%d]", l.Size())
 	}
 
 	count := 0
-	l.RangeReverseLimit(2, func(data Item)bool {
+	l.RangeReverseLimit(2, func(data Item) bool {
 		it := data.(*item)
 		fmt.Println(it.key1, it.key2)
 		count++
@@ -161,10 +177,10 @@ func TestRangeReverseLimit(t *testing.T) {
 	}
 }
 
-func BenchmarkAdd(b *testing.B){
+func BenchmarkAdd(b *testing.B) {
 	b.ResetTimer()
 	l := NewSortedList()
-	for i:=0;i<b.N;i++{
+	for i := 0; i < b.N; i++ {
 		l.Add(newItem(rand.Intn(BucketMaxLength), rand.Intn(InnerBucketMaxLength)))
 	}
 	if b.N != l.Size() {
@@ -172,6 +188,3 @@ func BenchmarkAdd(b *testing.B){
 	}
 	fmt.Println(l.Size(), b.N)
 }
-
-
-
diff --git a/pkg/util/digestutils/digest_reader_test.go b/pkg/util/digestutils/digest_reader_test.go
index 63a987ba..5c147363 100644
--- a/pkg/util/digestutils/digest_reader_test.go
+++ b/pkg/util/digestutils/digest_reader_test.go
@@ -21,13 +21,14 @@ import (
 	"crypto/md5"
 	"encoding/hex"
 	"io/ioutil"
+	"os"
 	"testing"
 
 	testifyassert "github.com/stretchr/testify/assert"
 )
 
 func TestMain(m *testing.M) {
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestNewDigestReader(t *testing.T) {
diff --git a/pkg/util/fileutils/test/file_utils_test.go b/pkg/util/fileutils/test/file_utils_test.go
index e128dc2d..94ab42e7 100644
--- a/pkg/util/fileutils/test/file_utils_test.go
+++ b/pkg/util/fileutils/test/file_utils_test.go
@@ -60,7 +60,7 @@ func (s *FileUtilsTestSuite) TearDownSuite() {
 	}
 }
 
-func (s *FileUtilsTestSuite) BeforeTest(suiteName, testName string) () {
+func (s *FileUtilsTestSuite) BeforeTest(suiteName, testName string) {
 	s.testDir = filepath.Join(s.workDir, testName)
 	s.testFile = filepath.Join(s.testDir, uuid.New().String())
 }
@@ -78,7 +78,7 @@ func (s *FileUtilsTestSuite) TestDeleteFile() {
 	s.Require().Nil(err)
 
 	s.Require().True(fileutils.PathExist(s.testFile))
-	err = fileutils.DeleteFile(s.testFile)
+	_ = fileutils.DeleteFile(s.testFile)
 	s.Require().False(fileutils.PathExist(s.testFile))
 }
 
diff --git a/pkg/util/httputils/http_util_test.go b/pkg/util/httputils/http_util_test.go
index 0aaa7b12..00064bb2 100644
--- a/pkg/util/httputils/http_util_test.go
+++ b/pkg/util/httputils/http_util_test.go
@@ -289,7 +289,7 @@ func (s *HTTPUtilTestSuite) TestRegisterProtocol() {
 	defer resp.Body.Close()
 
 	s.NotNil(resp)
-	buf := make([]byte,0)
+	buf := make([]byte, 0)
 	resp.Body.Read(buf)
 	fmt.Println(string(buf))
 	fmt.Println(resp.ContentLength)