Repository: dragonflyoss/Dragonfly2
Pull request #780 (2021-11-03 07:07:05)

chore: update golang import lint
Signed-off-by: Jim Ma <majinjing3@gmail.com>

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue

<!--- 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)
- [ ] 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.
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.


codecov-commenter: # [Codecov](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) Report
> Merging [#780](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) (bd2a035) into [main](https://codecov.io/gh/dragonflyoss/Dragonfly2/commit/7ad9f25271fbb149c879a5416d4a2012767f95b6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) (7ad9f25) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/graphs/tree.svg?width=650&height=150&src=pr&token=PUICJYSAT7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss)](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss)

```diff
@@            Coverage Diff             @@
##             main     #780      +/-   ##
==========================================
- Coverage   39.58%   39.57%   -0.02%     
==========================================
  Files          94       94              
  Lines        7647     7647              
==========================================
- Hits         3027     3026       -1     
  Misses       4226     4226              
- Partials      394      395       +1     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `39.57% <ø> (-0.02%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) | Coverage Δ | |
|---|---|---|
| [cdn/rpcserver/rpcserver.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3JwY3NlcnZlci9ycGNzZXJ2ZXIuZ28=) | `0.00% <ø> (ø)` | |
| [cdn/storedriver/driver.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N0b3JlZHJpdmVyL2RyaXZlci5nbw==) | `16.66% <ø> (ø)` | |
| [cdn/storedriver/store\_mgr.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N0b3JlZHJpdmVyL3N0b3JlX21nci5nbw==) | `60.00% <ø> (ø)` | |
| [cdn/storedriver/store\_util.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N0b3JlZHJpdmVyL3N0b3JlX3V0aWwuZ28=) | `0.00% <ø> (ø)` | |
| [cdn/supervisor/cdn/cache\_data\_mgr.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL2NhY2hlX2RhdGFfbWdyLmdv) | `76.40% <ø> (ø)` | |
| [cdn/supervisor/cdn/cache\_detector.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL2NhY2hlX2RldGVjdG9yLmdv) | `57.25% <ø> (ø)` | |
| [cdn/supervisor/cdn/cache\_writer.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL2NhY2hlX3dyaXRlci5nbw==) | `80.55% <ø> (ø)` | |
| [cdn/supervisor/cdn/downloader.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL2Rvd25sb2FkZXIuZ28=) | `62.50% <ø> (ø)` | |
| [cdn/supervisor/cdn/manager.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL21hbmFnZXIuZ28=) | `61.40% <ø> (ø)` | |
| [cdn/supervisor/cdn/reporter.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvY2RuL3JlcG9ydGVyLmdv) | `84.21% <ø> (ø)` | |
| ... and [21 more](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/780/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) | |


Patch:
diff --git a/.golangci.yml b/.golangci.yml
index b85097cb..4b8bb515 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -5,10 +5,13 @@ run:
 linters-settings:
   gocyclo:
     min-complexity: 40
+  gci:
+    local-prefixes: d7y.io/dragonfly/v2
 
 linters:
   disable-all: true
   enable:
+    - gci
     - gofmt
     - goimports
     - golint
diff --git a/cdn/cdn.go b/cdn/cdn.go
index 5b76490d..d48dba58 100644
--- a/cdn/cdn.go
+++ b/cdn/cdn.go
@@ -24,6 +24,10 @@ import (
 	"runtime"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
+	"google.golang.org/grpc"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/metrics"
 	"d7y.io/dragonfly/v2/cdn/plugins"
@@ -38,9 +42,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/manager"
 	managerclient "d7y.io/dragonfly/v2/pkg/rpc/manager/client"
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
-	"google.golang.org/grpc"
 )
 
 const (
diff --git a/cdn/config/config.go b/cdn/config/config.go
index 2e34b062..812e8371 100644
--- a/cdn/config/config.go
+++ b/cdn/config/config.go
@@ -19,6 +19,8 @@ package config
 import (
 	"time"
 
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/storedriver/local"
@@ -28,7 +30,6 @@ import (
 	"d7y.io/dragonfly/v2/cmd/dependency/base"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
-	"gopkg.in/yaml.v3"
 )
 
 // New creates an instant with default values.
diff --git a/cdn/metrics/metrics.go b/cdn/metrics/metrics.go
index aa7513dd..cabb2283 100644
--- a/cdn/metrics/metrics.go
+++ b/cdn/metrics/metrics.go
@@ -19,13 +19,14 @@ package metrics
 import (
 	"net/http"
 
-	"d7y.io/dragonfly/v2/cdn/config"
-	"d7y.io/dragonfly/v2/internal/constants"
 	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 	"github.com/prometheus/client_golang/prometheus"
 	"github.com/prometheus/client_golang/prometheus/promauto"
 	"github.com/prometheus/client_golang/prometheus/promhttp"
 	"google.golang.org/grpc"
+
+	"d7y.io/dragonfly/v2/cdn/config"
+	"d7y.io/dragonfly/v2/internal/constants"
 )
 
 // Variables declared for metrics.
diff --git a/cdn/rpcserver/rpcserver.go b/cdn/rpcserver/rpcserver.go
index 3e1715aa..ae2d328c 100644
--- a/cdn/rpcserver/rpcserver.go
+++ b/cdn/rpcserver/rpcserver.go
@@ -21,6 +21,11 @@ import (
 	"fmt"
 	"strings"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/trace"
+	"google.golang.org/grpc"
+
 	"d7y.io/dragonfly/v2/cdn/cdnutil"
 	"d7y.io/dragonfly/v2/cdn/config"
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
@@ -37,10 +42,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
 	"d7y.io/dragonfly/v2/pkg/util/net/urlutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/trace"
-	"google.golang.org/grpc"
 )
 
 var tracer = otel.Tracer("cdn-server")
diff --git a/cdn/storedriver/driver.go b/cdn/storedriver/driver.go
index b98703a8..19290da2 100644
--- a/cdn/storedriver/driver.go
+++ b/cdn/storedriver/driver.go
@@ -23,11 +23,12 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/pkg/errors"
+
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
 )
 
 // Driver defines an interface to manage the data stored in the driver.
diff --git a/cdn/storedriver/store_mgr.go b/cdn/storedriver/store_mgr.go
index 274624f4..e48bb9e2 100644
--- a/cdn/storedriver/store_mgr.go
+++ b/cdn/storedriver/store_mgr.go
@@ -21,9 +21,10 @@ import (
 	"path/filepath"
 	"strings"
 
+	"github.com/mitchellh/mapstructure"
+
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/pkg/util/fileutils"
-	"github.com/mitchellh/mapstructure"
 )
 
 // DriverBuilder is a function that creates a new storage driver plugin instant with the giving Config.
diff --git a/cdn/storedriver/store_util.go b/cdn/storedriver/store_util.go
index 950369bf..e1d0f46c 100644
--- a/cdn/storedriver/store_util.go
+++ b/cdn/storedriver/store_util.go
@@ -17,8 +17,9 @@
 package storedriver
 
 import (
-	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"github.com/pkg/errors"
+
+	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 )
 
 // CheckGetRaw check before get Raw
diff --git a/cdn/supervisor/cdn/cache_data_mgr.go b/cdn/supervisor/cdn/cache_data_mgr.go
index dc5a7662..6c0dd149 100644
--- a/cdn/supervisor/cdn/cache_data_mgr.go
+++ b/cdn/supervisor/cdn/cache_data_mgr.go
@@ -21,6 +21,8 @@ import (
 	"io"
 	"sort"
 
+	"github.com/pkg/errors"
+
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
 	"d7y.io/dragonfly/v2/cdn/types"
@@ -29,7 +31,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 	"d7y.io/dragonfly/v2/pkg/util/timeutils"
-	"github.com/pkg/errors"
 )
 
 // cacheDataManager manages the meta file and piece meta file of each TaskId.
diff --git a/cdn/supervisor/cdn/cache_detector.go b/cdn/supervisor/cdn/cache_detector.go
index ee6dcc5e..1b2c6c7d 100644
--- a/cdn/supervisor/cdn/cache_detector.go
+++ b/cdn/supervisor/cdn/cache_detector.go
@@ -26,6 +26,9 @@ import (
 	"sort"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel/trace"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
@@ -34,8 +37,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/source"
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel/trace"
 )
 
 // cacheDetector detect task cache
diff --git a/cdn/supervisor/cdn/cache_writer.go b/cdn/supervisor/cdn/cache_writer.go
index 5e8467ba..e91c50c2 100644
--- a/cdn/supervisor/cdn/cache_writer.go
+++ b/cdn/supervisor/cdn/cache_writer.go
@@ -25,13 +25,14 @@ import (
 	"io"
 	"sync"
 
+	"go.opentelemetry.io/otel/trace"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
 	"d7y.io/dragonfly/v2/cdn/types"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-	"go.opentelemetry.io/otel/trace"
 )
 
 type piece struct {
diff --git a/cdn/supervisor/cdn/downloader.go b/cdn/supervisor/cdn/downloader.go
index ce2accc3..58e08d62 100644
--- a/cdn/supervisor/cdn/downloader.go
+++ b/cdn/supervisor/cdn/downloader.go
@@ -21,11 +21,12 @@ import (
 	"fmt"
 	"io"
 
+	"github.com/pkg/errors"
+
 	"d7y.io/dragonfly/v2/cdn/types"
 	"d7y.io/dragonfly/v2/pkg/source"
 	"d7y.io/dragonfly/v2/pkg/util/maputils"
 	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-	"github.com/pkg/errors"
 )
 
 const RangeHeaderName = "Range"
diff --git a/cdn/supervisor/cdn/manager.go b/cdn/supervisor/cdn/manager.go
index 12f16caf..13ad0aa4 100644
--- a/cdn/supervisor/cdn/manager.go
+++ b/cdn/supervisor/cdn/manager.go
@@ -17,32 +17,29 @@
 package cdn
 
 import (
+	"context"
 	"crypto/md5"
+	"fmt"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/util/digestutils"
+	"github.com/pkg/errors"
 	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/trace"
 
-	"context"
-	"fmt"
-
-	"d7y.io/dragonfly/v2/cdn/supervisor"
-	_ "d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage/disk"   // To register diskStorage
-	_ "d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage/hybrid" // To register hybridStorage
-	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/server"
-
-	"d7y.io/dragonfly/v2/pkg/synclock"
-	"d7y.io/dragonfly/v2/pkg/util/timeutils"
-
 	"d7y.io/dragonfly/v2/cdn/config"
+	"d7y.io/dragonfly/v2/cdn/supervisor"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
+	_ "d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage/disk"   // nolint
+	_ "d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage/hybrid" // nolint
 	"d7y.io/dragonfly/v2/cdn/types"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/ratelimiter/limitreader"
 	"d7y.io/dragonfly/v2/pkg/ratelimiter/ratelimiter"
+	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/server"
+	"d7y.io/dragonfly/v2/pkg/synclock"
+	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
+	"d7y.io/dragonfly/v2/pkg/util/timeutils"
 )
 
 // Ensure that Manager implements the CDNMgr interface
diff --git a/cdn/supervisor/cdn/reporter.go b/cdn/supervisor/cdn/reporter.go
index 4325a254..ebf04930 100644
--- a/cdn/supervisor/cdn/reporter.go
+++ b/cdn/supervisor/cdn/reporter.go
@@ -19,12 +19,13 @@ package cdn
 import (
 	"context"
 
+	"github.com/pkg/errors"
+	"go.uber.org/zap"
+
 	"d7y.io/dragonfly/v2/cdn/supervisor"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
 	"d7y.io/dragonfly/v2/cdn/types"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"github.com/pkg/errors"
-	"go.uber.org/zap"
 )
 
 type reporter struct {
diff --git a/cdn/supervisor/cdn/storage/disk/disk.go b/cdn/supervisor/cdn/storage/disk/disk.go
index 51b46416..c528c43d 100644
--- a/cdn/supervisor/cdn/storage/disk/disk.go
+++ b/cdn/supervisor/cdn/storage/disk/disk.go
@@ -25,6 +25,8 @@ import (
 	"strings"
 	"time"
 
+	"github.com/pkg/errors"
+	"github.com/sirupsen/logrus"
 	"go.uber.org/atomic"
 
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
@@ -38,8 +40,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/synclock"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/fileutils"
-	"github.com/pkg/errors"
-	"github.com/sirupsen/logrus"
 )
 
 const StorageMode = storage.DiskStorageMode
diff --git a/cdn/supervisor/cdn/storage/hybrid/hybrid.go b/cdn/supervisor/cdn/storage/hybrid/hybrid.go
index 008b312b..8861bff8 100644
--- a/cdn/supervisor/cdn/storage/hybrid/hybrid.go
+++ b/cdn/supervisor/cdn/storage/hybrid/hybrid.go
@@ -26,6 +26,9 @@ import (
 	"sync"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.uber.org/atomic"
+
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/storedriver/local"
@@ -37,8 +40,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/synclock"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/fileutils"
-	"github.com/pkg/errors"
-	"go.uber.org/atomic"
 )
 
 const StorageMode = storage.HybridStorageMode
diff --git a/cdn/supervisor/cdn/storage/hybrid/shm_switch.go b/cdn/supervisor/cdn/storage/hybrid/shm_switch.go
index 41d5bf16..17ffcef8 100644
--- a/cdn/supervisor/cdn/storage/hybrid/shm_switch.go
+++ b/cdn/supervisor/cdn/storage/hybrid/shm_switch.go
@@ -19,8 +19,9 @@ package hybrid
 import (
 	"regexp"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"go.uber.org/atomic"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
 )
 
 type shmSwitch struct {
diff --git a/cdn/supervisor/cdn/storage/storage_gc.go b/cdn/supervisor/cdn/storage/storage_gc.go
index 0af93fff..86c411dc 100644
--- a/cdn/supervisor/cdn/storage/storage_gc.go
+++ b/cdn/supervisor/cdn/storage/storage_gc.go
@@ -22,13 +22,14 @@ import (
 	"strings"
 	"time"
 
+	"github.com/emirpasic/gods/maps/treemap"
+	godsutils "github.com/emirpasic/gods/utils"
+
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/supervisor"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/util/timeutils"
-	"github.com/emirpasic/gods/maps/treemap"
-	godsutils "github.com/emirpasic/gods/utils"
 )
 
 type Cleaner struct {
diff --git a/cdn/supervisor/cdn/storage/storage_mgr.go b/cdn/supervisor/cdn/storage/storage_mgr.go
index 22d2df7c..fd0fb09e 100644
--- a/cdn/supervisor/cdn/storage/storage_mgr.go
+++ b/cdn/supervisor/cdn/storage/storage_mgr.go
@@ -25,15 +25,16 @@ import (
 	"strings"
 	"time"
 
+	"github.com/mitchellh/mapstructure"
+	"github.com/pkg/errors"
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/supervisor"
 	"d7y.io/dragonfly/v2/cdn/types"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-	"github.com/mitchellh/mapstructure"
-	"github.com/pkg/errors"
-	"gopkg.in/yaml.v3"
 )
 
 type Manager interface {
diff --git a/cdn/supervisor/progress/manager.go b/cdn/supervisor/progress/manager.go
index d6fefe5b..020da131 100644
--- a/cdn/supervisor/progress/manager.go
+++ b/cdn/supervisor/progress/manager.go
@@ -26,6 +26,9 @@ import (
 	"sync"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel/trace"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/supervisor"
 	"d7y.io/dragonfly/v2/cdn/types"
@@ -33,8 +36,6 @@ import (
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/structure/syncmap"
 	"d7y.io/dragonfly/v2/pkg/synclock"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel/trace"
 )
 
 var _ supervisor.SeedProgressMgr = (*Manager)(nil)
diff --git a/cdn/supervisor/task/manager.go b/cdn/supervisor/task/manager.go
index 41d5cc2c..c0522867 100644
--- a/cdn/supervisor/task/manager.go
+++ b/cdn/supervisor/task/manager.go
@@ -21,6 +21,10 @@ import (
 	"encoding/json"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/trace"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/supervisor"
@@ -31,9 +35,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/structure/syncmap"
 	"d7y.io/dragonfly/v2/pkg/synclock"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/trace"
 )
 
 // Ensure that Manager implements the SeedTaskMgr and gcExecutor interfaces
diff --git a/cdn/supervisor/task/manager_util.go b/cdn/supervisor/task/manager_util.go
index 1d301c92..0cf4a87e 100644
--- a/cdn/supervisor/task/manager_util.go
+++ b/cdn/supervisor/task/manager_util.go
@@ -22,6 +22,9 @@ import (
 	"reflect"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel/trace"
+
 	"d7y.io/dragonfly/v2/cdn/cdnutil"
 	"d7y.io/dragonfly/v2/cdn/config"
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
@@ -31,8 +34,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/synclock"
 	"d7y.io/dragonfly/v2/pkg/util/net/urlutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel/trace"
 )
 
 // addOrUpdateTask add a new task or update exist task
diff --git a/client/config/dfget.go b/client/config/dfget.go
index b70764fd..9f4671d2 100644
--- a/client/config/dfget.go
+++ b/client/config/dfget.go
@@ -27,14 +27,14 @@ import (
 	"syscall"
 	"time"
 
-	"d7y.io/dragonfly/v2/cmd/dependency/base"
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/unit"
 	"github.com/pkg/errors"
 	"golang.org/x/time/rate"
 
+	"d7y.io/dragonfly/v2/cmd/dependency/base"
 	"d7y.io/dragonfly/v2/internal/dferrors"
+	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/basic"
+	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/net/urlutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 )
diff --git a/client/config/peerhost.go b/client/config/peerhost.go
index 700876fc..39a906b3 100644
--- a/client/config/peerhost.go
+++ b/client/config/peerhost.go
@@ -33,13 +33,12 @@ import (
 	"github.com/pkg/errors"
 	"gopkg.in/yaml.v3"
 
-	"d7y.io/dragonfly/v2/cmd/dependency/base"
-	"d7y.io/dragonfly/v2/pkg/unit"
-	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-
 	"d7y.io/dragonfly/v2/client/clientutil"
+	"d7y.io/dragonfly/v2/cmd/dependency/base"
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
+	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
+	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 )
 
 type DaemonConfig = DaemonOption
diff --git a/client/daemon/daemon_linux.go b/client/daemon/daemon_linux.go
index 6848a2b3..d73a9a50 100644
--- a/client/daemon/daemon_linux.go
+++ b/client/daemon/daemon_linux.go
@@ -22,8 +22,9 @@ import (
 	"fmt"
 	"os"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"golang.org/x/sys/unix"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
 )
 
 func switchNetNamespace(target string) (func() error, error) {
diff --git a/client/dfget/dfget.go b/client/dfget/dfget.go
index 8c9df1c2..ffb1d7fc 100644
--- a/client/dfget/dfget.go
+++ b/client/dfget/dfget.go
@@ -26,6 +26,9 @@ import (
 	"strings"
 	"time"
 
+	"github.com/pkg/errors"
+	"github.com/schollz/progressbar/v3"
+
 	"d7y.io/dragonfly/v2/client/config"
 	"d7y.io/dragonfly/v2/internal/dfheaders"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
@@ -36,8 +39,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/source"
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/pkg/errors"
-	"github.com/schollz/progressbar/v3"
 )
 
 func Download(cfg *config.DfgetConfig, client daemonclient.DaemonClient) error {
diff --git a/cmd/cdn/cmd/root.go b/cmd/cdn/cmd/root.go
index 1fe03811..86e80d1c 100644
--- a/cmd/cdn/cmd/root.go
+++ b/cmd/cdn/cmd/root.go
@@ -19,15 +19,16 @@ package cmd
 import (
 	"os"
 
+	"github.com/pkg/errors"
+	"github.com/spf13/cobra"
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/cdn"
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cmd/dependency"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/dflog/logcore"
 	"d7y.io/dragonfly/v2/version"
-	"github.com/pkg/errors"
-	"github.com/spf13/cobra"
-	"gopkg.in/yaml.v3"
 )
 
 var (
diff --git a/cmd/cdn/main.go b/cmd/cdn/main.go
index 8daf6b36..8c6c20f6 100644
--- a/cmd/cdn/main.go
+++ b/cmd/cdn/main.go
@@ -18,8 +18,10 @@ package main
 
 import (
 	"d7y.io/dragonfly/v2/cmd/cdn/cmd"
+
 	// Register http client
 	_ "d7y.io/dragonfly/v2/pkg/source/httpprotocol"
+
 	// Register oss client
 	_ "d7y.io/dragonfly/v2/pkg/source/ossprotocol"
 )
diff --git a/cmd/dependency/dependency.go b/cmd/dependency/dependency.go
index 1ac05896..00dee5aa 100644
--- a/cmd/dependency/dependency.go
+++ b/cmd/dependency/dependency.go
@@ -27,7 +27,6 @@ import (
 	"syscall"
 	"time"
 
-	"d7y.io/dragonfly/v2/cmd/dependency/base"
 	"github.com/go-echarts/statsview"
 	"github.com/go-echarts/statsview/viewer"
 	"github.com/mitchellh/mapstructure"
@@ -46,6 +45,7 @@ import (
 
 	"d7y.io/dragonfly/v2/client/clientutil"
 	"d7y.io/dragonfly/v2/client/config"
+	"d7y.io/dragonfly/v2/cmd/dependency/base"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/dflog/logcore"
 	"d7y.io/dragonfly/v2/internal/dfpath"
diff --git a/cmd/dependency/doc_cmd.go b/cmd/dependency/doc_cmd.go
index 9f6d6f3b..c031f87f 100644
--- a/cmd/dependency/doc_cmd.go
+++ b/cmd/dependency/doc_cmd.go
@@ -19,10 +19,11 @@ package dependency
 import (
 	"fmt"
 
-	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra/doc"
+
+	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 )
 
 // genDocCommand is used to implement 'doc' command.
diff --git a/cmd/dependency/version_cmd.go b/cmd/dependency/version_cmd.go
index a414aef2..a849e7ba 100644
--- a/cmd/dependency/version_cmd.go
+++ b/cmd/dependency/version_cmd.go
@@ -19,8 +19,9 @@ package dependency
 import (
 	"fmt"
 
-	"d7y.io/dragonfly/v2/version"
 	"github.com/spf13/cobra"
+
+	"d7y.io/dragonfly/v2/version"
 )
 
 var VersionCmd = &cobra.Command{
diff --git a/cmd/dfget/cmd/daemon.go b/cmd/dfget/cmd/daemon.go
index 52b8ae21..ada89b64 100644
--- a/cmd/dfget/cmd/daemon.go
+++ b/cmd/dfget/cmd/daemon.go
@@ -21,6 +21,12 @@ import (
 	"os"
 	"time"
 
+	"github.com/gofrs/flock"
+	"github.com/pkg/errors"
+	"github.com/spf13/cobra"
+	"github.com/spf13/viper"
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/client/config"
 	server "d7y.io/dragonfly/v2/client/daemon"
 	"d7y.io/dragonfly/v2/cmd/dependency"
@@ -30,11 +36,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
 	"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon/client"
 	"d7y.io/dragonfly/v2/version"
-	"github.com/gofrs/flock"
-	"github.com/pkg/errors"
-	"github.com/spf13/cobra"
-	"github.com/spf13/viper"
-	"gopkg.in/yaml.v3"
 )
 
 var (
diff --git a/cmd/dfget/cmd/root.go b/cmd/dfget/cmd/root.go
index 2495e2b1..b507e26a 100644
--- a/cmd/dfget/cmd/root.go
+++ b/cmd/dfget/cmd/root.go
@@ -25,6 +25,12 @@ import (
 	"syscall"
 	"time"
 
+	"github.com/gofrs/flock"
+	"github.com/pkg/errors"
+	"github.com/spf13/cobra"
+	"github.com/spf13/viper"
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/client/config"
 	"d7y.io/dragonfly/v2/client/dfget"
 	"d7y.io/dragonfly/v2/cmd/dependency"
@@ -38,11 +44,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
 	"d7y.io/dragonfly/v2/version"
-	"github.com/gofrs/flock"
-	"github.com/pkg/errors"
-	"github.com/spf13/cobra"
-	"github.com/spf13/viper"
-	"gopkg.in/yaml.v3"
 )
 
 var (
diff --git a/cmd/dfget/main.go b/cmd/dfget/main.go
index 06915819..c12d4bd5 100644
--- a/cmd/dfget/main.go
+++ b/cmd/dfget/main.go
@@ -18,8 +18,10 @@ package main
 
 import (
 	"d7y.io/dragonfly/v2/cmd/dfget/cmd"
+
 	// Register http client
 	_ "d7y.io/dragonfly/v2/pkg/source/httpprotocol"
+
 	// Register oss client
 	_ "d7y.io/dragonfly/v2/pkg/source/ossprotocol"
 )
diff --git a/cmd/manager/cmd/root.go b/cmd/manager/cmd/root.go
index 7fe465d5..3d0f537a 100644
--- a/cmd/manager/cmd/root.go
+++ b/cmd/manager/cmd/root.go
@@ -19,15 +19,16 @@ package cmd
 import (
 	"os"
 
+	"github.com/pkg/errors"
+	"github.com/spf13/cobra"
+	"gopkg.in/yaml.v3"
+
 	"d7y.io/dragonfly/v2/cmd/dependency"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/dflog/logcore"
 	"d7y.io/dragonfly/v2/manager"
 	"d7y.io/dragonfly/v2/manager/config"
 	"d7y.io/dragonfly/v2/version"
-	"github.com/pkg/errors"
-	"github.com/spf13/cobra"
-	"gopkg.in/yaml.v3"
 )
 
 var (
diff --git a/internal/dferrors/error.go b/internal/dferrors/error.go
index 612d7265..aa46e1b7 100644
--- a/internal/dferrors/error.go
+++ b/internal/dferrors/error.go
@@ -19,8 +19,9 @@ package dferrors
 import (
 	"fmt"
 
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"github.com/pkg/errors"
+
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
 )
 
 // common and framework errors
diff --git a/internal/job/job.go b/internal/job/job.go
index 47e095cd..78dace94 100644
--- a/internal/job/job.go
+++ b/internal/job/job.go
@@ -23,13 +23,12 @@ import (
 	"reflect"
 	"time"
 
-	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
-	"github.com/go-redis/redis/v8"
-	"github.com/pkg/errors"
-
 	"github.com/RichardKnop/machinery/v1"
 	machineryv1config "github.com/RichardKnop/machinery/v1/config"
 	machineryv1log "github.com/RichardKnop/machinery/v1/log"
+	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+	"github.com/go-redis/redis/v8"
+	"github.com/pkg/errors"
 )
 
 const (
diff --git a/manager/cache/cache.go b/manager/cache/cache.go
index dc20488b..3f1023bb 100644
--- a/manager/cache/cache.go
+++ b/manager/cache/cache.go
@@ -20,9 +20,10 @@ import (
 	"fmt"
 	"time"
 
+	"github.com/go-redis/cache/v8"
+
 	"d7y.io/dragonfly/v2/manager/config"
 	"d7y.io/dragonfly/v2/manager/database"
-	"github.com/go-redis/cache/v8"
 )
 
 const (
diff --git a/manager/handlers/cdn.go b/manager/handlers/cdn.go
index 90056edf..e2f923aa 100644
--- a/manager/handlers/cdn.go
+++ b/manager/handlers/cdn.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create CDN
diff --git a/manager/handlers/cdn_cluster.go b/manager/handlers/cdn_cluster.go
index a8a852df..74ae4589 100644
--- a/manager/handlers/cdn_cluster.go
+++ b/manager/handlers/cdn_cluster.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create CDNCluster
diff --git a/manager/handlers/config.go b/manager/handlers/config.go
index e0a0a8a7..2999a33f 100644
--- a/manager/handlers/config.go
+++ b/manager/handlers/config.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create Config
diff --git a/manager/handlers/handlers.go b/manager/handlers/handlers.go
index ff49751a..b9d4ec73 100644
--- a/manager/handlers/handlers.go
+++ b/manager/handlers/handlers.go
@@ -21,8 +21,9 @@ import (
 	"strconv"
 	"strings"
 
-	"d7y.io/dragonfly/v2/manager/service"
 	"github.com/gin-gonic/gin"
+
+	"d7y.io/dragonfly/v2/manager/service"
 )
 
 type Handlers struct {
diff --git a/manager/handlers/job.go b/manager/handlers/job.go
index 6a5f05d1..3dc9bb8b 100644
--- a/manager/handlers/job.go
+++ b/manager/handlers/job.go
@@ -3,12 +3,12 @@ package handlers
 import (
 	"net/http"
 
-	"d7y.io/dragonfly/v2/internal/job"
-	// nolint
-	_ "d7y.io/dragonfly/v2/manager/model"
-	"d7y.io/dragonfly/v2/manager/types"
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin/binding"
+
+	"d7y.io/dragonfly/v2/internal/job"
+	_ "d7y.io/dragonfly/v2/manager/model" // nolint
+	"d7y.io/dragonfly/v2/manager/types"
 )
 
 // @Summary Create Job
diff --git a/manager/handlers/oauth.go b/manager/handlers/oauth.go
index 12af8933..cd7c1c0b 100644
--- a/manager/handlers/oauth.go
+++ b/manager/handlers/oauth.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create Oauth
diff --git a/manager/handlers/permission.go b/manager/handlers/permission.go
index b3559a91..81556866 100644
--- a/manager/handlers/permission.go
+++ b/manager/handlers/permission.go
@@ -19,9 +19,10 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/permission/rbac"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Get Permissions
diff --git a/manager/handlers/preheat.go b/manager/handlers/preheat.go
index 27b78610..b3ed4b80 100644
--- a/manager/handlers/preheat.go
+++ b/manager/handlers/preheat.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create V1 Preheat
diff --git a/manager/handlers/role.go b/manager/handlers/role.go
index e416606f..6196bf0c 100644
--- a/manager/handlers/role.go
+++ b/manager/handlers/role.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create Role
diff --git a/manager/handlers/scheduler.go b/manager/handlers/scheduler.go
index 3a1ad25b..bbaab3b0 100644
--- a/manager/handlers/scheduler.go
+++ b/manager/handlers/scheduler.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create Scheduler
diff --git a/manager/handlers/scheduler_cluster.go b/manager/handlers/scheduler_cluster.go
index 55b84457..989e4b6c 100644
--- a/manager/handlers/scheduler_cluster.go
+++ b/manager/handlers/scheduler_cluster.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create SchedulerCluster
diff --git a/manager/handlers/security_group.go b/manager/handlers/security_group.go
index 9993adc7..816a3e1c 100644
--- a/manager/handlers/security_group.go
+++ b/manager/handlers/security_group.go
@@ -19,10 +19,11 @@ package handlers
 import (
 	"net/http"
 
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Create SecurityGroup
diff --git a/manager/handlers/user.go b/manager/handlers/user.go
index d53d881b..ec580dd7 100644
--- a/manager/handlers/user.go
+++ b/manager/handlers/user.go
@@ -19,11 +19,12 @@ package handlers
 import (
 	"net/http"
 
+	jwt "github.com/appleboy/gin-jwt/v2"
+	"github.com/gin-gonic/gin"
+
 	// nolint
 	_ "d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	jwt "github.com/appleboy/gin-jwt/v2"
-	"github.com/gin-gonic/gin"
 )
 
 // @Summary Get User
diff --git a/manager/job/preheat.go b/manager/job/preheat.go
index 7d3a92f4..04a7ef65 100644
--- a/manager/job/preheat.go
+++ b/manager/job/preheat.go
@@ -27,17 +27,18 @@ import (
 	"strings"
 	"time"
 
+	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+	"github.com/distribution/distribution/v3"
+	"github.com/distribution/distribution/v3/manifest/schema2"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/trace"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	internaljob "d7y.io/dragonfly/v2/internal/job"
 	"d7y.io/dragonfly/v2/manager/config"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
 	"d7y.io/dragonfly/v2/pkg/util/net/httputils"
-	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
-	"github.com/distribution/distribution/v3"
-	"github.com/distribution/distribution/v3/manifest/schema2"
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/trace"
 )
 
 var tracer = otel.Tracer("sender")
diff --git a/manager/manager.go b/manager/manager.go
index 4445e961..0d34209d 100644
--- a/manager/manager.go
+++ b/manager/manager.go
@@ -21,6 +21,8 @@ import (
 	"net/http"
 	"time"
 
+	"google.golang.org/grpc"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/manager/cache"
 	"d7y.io/dragonfly/v2/manager/config"
@@ -33,7 +35,6 @@ import (
 	"d7y.io/dragonfly/v2/manager/service"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	grpc_manager_server "d7y.io/dragonfly/v2/pkg/rpc/manager/server"
-	"google.golang.org/grpc"
 )
 
 const (
diff --git a/manager/metrics/metrics.go b/manager/metrics/metrics.go
index c42eb95a..f66bfcd3 100644
--- a/manager/metrics/metrics.go
+++ b/manager/metrics/metrics.go
@@ -19,10 +19,11 @@ package metrics
 import (
 	"net/http"
 
-	"d7y.io/dragonfly/v2/manager/config"
 	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 	"github.com/prometheus/client_golang/prometheus/promhttp"
 	"google.golang.org/grpc"
+
+	"d7y.io/dragonfly/v2/manager/config"
 )
 
 func New(cfg *config.RestConfig, grpcServer *grpc.Server) *http.Server {
diff --git a/manager/middlewares/error.go b/manager/middlewares/error.go
index 00d3a6fb..fc2f48d2 100644
--- a/manager/middlewares/error.go
+++ b/manager/middlewares/error.go
@@ -19,8 +19,6 @@ package middlewares
 import (
 	"net/http"
 
-	"d7y.io/dragonfly/v2/internal/dfcodes"
-	"d7y.io/dragonfly/v2/internal/dferrors"
 	"github.com/VividCortex/mysqlerr"
 	"github.com/gin-gonic/gin"
 	"github.com/go-sql-driver/mysql"
@@ -28,6 +26,9 @@ import (
 	"github.com/pkg/errors"
 	"golang.org/x/crypto/bcrypt"
 	"gorm.io/gorm"
+
+	"d7y.io/dragonfly/v2/internal/dfcodes"
+	"d7y.io/dragonfly/v2/internal/dferrors"
 )
 
 type ErrorResponse struct {
diff --git a/manager/middlewares/jwt.go b/manager/middlewares/jwt.go
index ac2e913f..f8ccd6cb 100644
--- a/manager/middlewares/jwt.go
+++ b/manager/middlewares/jwt.go
@@ -21,11 +21,12 @@ import (
 	"net/http"
 	"time"
 
+	jwt "github.com/appleboy/gin-jwt/v2"
+	"github.com/gin-gonic/gin"
+
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/service"
 	"d7y.io/dragonfly/v2/manager/types"
-	jwt "github.com/appleboy/gin-jwt/v2"
-	"github.com/gin-gonic/gin"
 )
 
 func Jwt(service service.REST) (*jwt.GinJWTMiddleware, error) {
diff --git a/manager/middlewares/rbac.go b/manager/middlewares/rbac.go
index be6d14e9..bd40a6ae 100644
--- a/manager/middlewares/rbac.go
+++ b/manager/middlewares/rbac.go
@@ -20,10 +20,11 @@ import (
 	"fmt"
 	"net/http"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/manager/permission/rbac"
 	"github.com/casbin/casbin/v2"
 	"github.com/gin-gonic/gin"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/manager/permission/rbac"
 )
 
 func RBAC(e *casbin.Enforcer) gin.HandlerFunc {
diff --git a/manager/permission/rbac/rbac.go b/manager/permission/rbac/rbac.go
index 76389fdc..8e126e68 100644
--- a/manager/permission/rbac/rbac.go
+++ b/manager/permission/rbac/rbac.go
@@ -22,14 +22,15 @@ import (
 	"net/http"
 	"regexp"
 
-	managermodel "d7y.io/dragonfly/v2/manager/model"
-	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 	"github.com/casbin/casbin/v2"
 	"github.com/casbin/casbin/v2/model"
 	gormadapter "github.com/casbin/gorm-adapter/v3"
 	"github.com/gin-gonic/gin"
 	"golang.org/x/crypto/bcrypt"
 	"gorm.io/gorm"
+
+	managermodel "d7y.io/dragonfly/v2/manager/model"
+	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 )
 
 // Syntax for models see https://casbin.org/docs/en/syntax-for-models
diff --git a/manager/router/router.go b/manager/router/router.go
index 0265376a..12d506bf 100644
--- a/manager/router/router.go
+++ b/manager/router/router.go
@@ -21,12 +21,6 @@ import (
 	"os"
 	"path/filepath"
 
-	"d7y.io/dragonfly/v2/internal/dfpath"
-	"d7y.io/dragonfly/v2/manager/config"
-	"d7y.io/dragonfly/v2/manager/handlers"
-	"d7y.io/dragonfly/v2/manager/middlewares"
-	"d7y.io/dragonfly/v2/manager/service"
-
 	"github.com/casbin/casbin/v2"
 	"github.com/gin-contrib/cors"
 	"github.com/gin-contrib/static"
@@ -35,6 +29,12 @@ import (
 	swaggerFiles "github.com/swaggo/files"
 	ginSwagger "github.com/swaggo/gin-swagger"
 	"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
+
+	"d7y.io/dragonfly/v2/internal/dfpath"
+	"d7y.io/dragonfly/v2/manager/config"
+	"d7y.io/dragonfly/v2/manager/handlers"
+	"d7y.io/dragonfly/v2/manager/middlewares"
+	"d7y.io/dragonfly/v2/manager/service"
 )
 
 const (
diff --git a/manager/searcher/searcher.go b/manager/searcher/searcher.go
index a750d0a3..8deeec52 100644
--- a/manager/searcher/searcher.go
+++ b/manager/searcher/searcher.go
@@ -19,9 +19,10 @@ package searcher
 import (
 	"sort"
 
-	"d7y.io/dragonfly/v2/manager/model"
 	"github.com/mitchellh/mapstructure"
 	"gonum.org/v1/gonum/stat"
+
+	"d7y.io/dragonfly/v2/manager/model"
 )
 
 const (
diff --git a/manager/service/job.go b/manager/service/job.go
index fedd897d..40bf8e34 100644
--- a/manager/service/job.go
+++ b/manager/service/job.go
@@ -20,12 +20,13 @@ import (
 	"context"
 	"fmt"
 
+	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
 	"d7y.io/dragonfly/v2/pkg/retry"
 	"d7y.io/dragonfly/v2/pkg/util/structutils"
-	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
 )
 
 func (s *rest) CreatePreheatJob(ctx context.Context, json types.CreatePreheatJobRequest) (*model.Job, error) {
diff --git a/manager/service/permission.go b/manager/service/permission.go
index 157c2705..7219b92a 100644
--- a/manager/service/permission.go
+++ b/manager/service/permission.go
@@ -19,8 +19,9 @@ package service
 import (
 	"context"
 
-	"d7y.io/dragonfly/v2/manager/permission/rbac"
 	"github.com/gin-gonic/gin"
+
+	"d7y.io/dragonfly/v2/manager/permission/rbac"
 )
 
 func (s *rest) GetPermissions(ctx context.Context, g *gin.Engine) []rbac.Permission {
diff --git a/manager/service/preheat.go b/manager/service/preheat.go
index f8bcd0c8..9e97d8f1 100644
--- a/manager/service/preheat.go
+++ b/manager/service/preheat.go
@@ -20,14 +20,14 @@ import (
 	"context"
 	"strconv"
 
+	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	internaljob "d7y.io/dragonfly/v2/internal/job"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/types"
-	"google.golang.org/grpc/codes"
-	"google.golang.org/grpc/status"
-
-	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
 )
 
 const (
diff --git a/manager/service/service.go b/manager/service/service.go
index 61b158aa..c1dfaa18 100644
--- a/manager/service/service.go
+++ b/manager/service/service.go
@@ -19,17 +19,17 @@ package service
 import (
 	"context"
 
+	"github.com/casbin/casbin/v2"
+	"github.com/gin-gonic/gin"
+	"github.com/go-redis/redis/v8"
+	"gorm.io/gorm"
+
 	"d7y.io/dragonfly/v2/manager/cache"
 	"d7y.io/dragonfly/v2/manager/database"
 	"d7y.io/dragonfly/v2/manager/job"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/permission/rbac"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/casbin/casbin/v2"
-	"github.com/gin-gonic/gin"
-	"github.com/go-redis/redis/v8"
-
-	"gorm.io/gorm"
 )
 
 type REST interface {
diff --git a/manager/service/service_grpc.go b/manager/service/service_grpc.go
index 2d254a5c..d09e739d 100644
--- a/manager/service/service_grpc.go
+++ b/manager/service/service_grpc.go
@@ -21,17 +21,18 @@ import (
 	"errors"
 	"io"
 
+	cachev8 "github.com/go-redis/cache/v8"
+	"github.com/go-redis/redis/v8"
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
+	"gorm.io/gorm"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/manager/cache"
 	"d7y.io/dragonfly/v2/manager/database"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/searcher"
 	"d7y.io/dragonfly/v2/pkg/rpc/manager"
-	cachev8 "github.com/go-redis/cache/v8"
-	"github.com/go-redis/redis/v8"
-	"google.golang.org/grpc/codes"
-	"google.golang.org/grpc/status"
-	"gorm.io/gorm"
 )
 
 type GRPC struct {
diff --git a/manager/service/user.go b/manager/service/user.go
index 76d7ea27..85f0c32b 100644
--- a/manager/service/user.go
+++ b/manager/service/user.go
@@ -20,15 +20,15 @@ import (
 	"context"
 	"fmt"
 
+	"github.com/VividCortex/mysqlerr"
+	"github.com/go-sql-driver/mysql"
 	"github.com/pkg/errors"
+	"golang.org/x/crypto/bcrypt"
 
 	manageroauth "d7y.io/dragonfly/v2/manager/auth/oauth"
 	"d7y.io/dragonfly/v2/manager/model"
 	"d7y.io/dragonfly/v2/manager/permission/rbac"
 	"d7y.io/dragonfly/v2/manager/types"
-	"github.com/VividCortex/mysqlerr"
-	"github.com/go-sql-driver/mysql"
-	"golang.org/x/crypto/bcrypt"
 )
 
 func (s *rest) GetUser(ctx context.Context, id uint) (*model.User, error) {
diff --git a/pkg/ratelimiter/ratelimiter/ratelimiter.go b/pkg/ratelimiter/ratelimiter/ratelimiter.go
index e3120e42..2e092686 100644
--- a/pkg/ratelimiter/ratelimiter/ratelimiter.go
+++ b/pkg/ratelimiter/ratelimiter/ratelimiter.go
@@ -17,10 +17,10 @@
 package ratelimiter
 
 import (
-	"d7y.io/dragonfly/v2/pkg/util/mathutils"
-
 	"sync"
 	"time"
+
+	"d7y.io/dragonfly/v2/pkg/util/mathutils"
 )
 
 // RateLimiter is used for limiting the rate of transporting.
diff --git a/pkg/rpc/base/common/common.go b/pkg/rpc/base/common/common.go
index 41cf88fc..b7845e23 100644
--- a/pkg/rpc/base/common/common.go
+++ b/pkg/rpc/base/common/common.go
@@ -19,10 +19,11 @@ package common
 import (
 	"reflect"
 
-	"d7y.io/dragonfly/v2/internal/dfcodes"
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
+
+	"d7y.io/dragonfly/v2/internal/dfcodes"
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
 )
 
 var EndOfPiece = int32(1) << 30
diff --git a/pkg/rpc/cdnsystem/client/client.go b/pkg/rpc/cdnsystem/client/client.go
index b26f1a59..62cc4120 100644
--- a/pkg/rpc/cdnsystem/client/client.go
+++ b/pkg/rpc/cdnsystem/client/client.go
@@ -21,13 +21,14 @@ import (
 	"sync"
 	"time"
 
+	"github.com/pkg/errors"
+	"google.golang.org/grpc"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
-	"github.com/pkg/errors"
-	"google.golang.org/grpc"
 )
 
 func GetClientByAddr(addrs []dfnet.NetAddr, opts ...grpc.DialOption) (CdnClient, error) {
diff --git a/pkg/rpc/cdnsystem/client/piece_seed_stream.go b/pkg/rpc/cdnsystem/client/piece_seed_stream.go
index da42b061..6d467dd1 100644
--- a/pkg/rpc/cdnsystem/client/piece_seed_stream.go
+++ b/pkg/rpc/cdnsystem/client/piece_seed_stream.go
@@ -19,14 +19,15 @@ package client
 import (
 	"context"
 
-	"d7y.io/dragonfly/v2/internal/dferrors"
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/rpc"
-	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
 	"github.com/pkg/errors"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
+
+	"d7y.io/dragonfly/v2/internal/dferrors"
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/pkg/rpc"
+	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
 )
 
 type PieceSeedStream struct {
diff --git a/pkg/rpc/cdnsystem/server/server.go b/pkg/rpc/cdnsystem/server/server.go
index c8d86454..0d335400 100644
--- a/pkg/rpc/cdnsystem/server/server.go
+++ b/pkg/rpc/cdnsystem/server/server.go
@@ -21,6 +21,10 @@ import (
 	"sync"
 	"time"
 
+	"go.uber.org/zap"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/peer"
+
 	"d7y.io/dragonfly/v2/cdn/metrics"
 	"d7y.io/dragonfly/v2/internal/dferrors"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
@@ -29,9 +33,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
 	"d7y.io/dragonfly/v2/pkg/safe"
 	"d7y.io/dragonfly/v2/pkg/util/net/iputils"
-	"go.uber.org/zap"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/peer"
 )
 
 // SeederServer  refer to cdnsystem.SeederServer
diff --git a/pkg/rpc/dfdaemon/client/client.go b/pkg/rpc/dfdaemon/client/client.go
index bfd842b3..6bae3140 100644
--- a/pkg/rpc/dfdaemon/client/client.go
+++ b/pkg/rpc/dfdaemon/client/client.go
@@ -22,16 +22,17 @@ import (
 	"sync"
 	"time"
 
+	"github.com/golang/protobuf/ptypes/empty"
+	"github.com/google/uuid"
+	"github.com/pkg/errors"
+	"google.golang.org/grpc"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/idgen"
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"
-	"github.com/golang/protobuf/ptypes/empty"
-	"github.com/google/uuid"
-	"github.com/pkg/errors"
-	"google.golang.org/grpc"
 )
 
 var _ DaemonClient = (*daemonClient)(nil)
diff --git a/pkg/rpc/dfdaemon/client/down_result_stream.go b/pkg/rpc/dfdaemon/client/down_result_stream.go
index f6f6e72f..dc92ced7 100644
--- a/pkg/rpc/dfdaemon/client/down_result_stream.go
+++ b/pkg/rpc/dfdaemon/client/down_result_stream.go
@@ -19,14 +19,15 @@ package client
 import (
 	"context"
 
-	"d7y.io/dragonfly/v2/internal/dferrors"
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/rpc"
-	"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"
 	"github.com/pkg/errors"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
+
+	"d7y.io/dragonfly/v2/internal/dferrors"
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/pkg/rpc"
+	"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"
 )
 
 type DownResultStream struct {
diff --git a/pkg/rpc/dfdaemon/client/peer.go b/pkg/rpc/dfdaemon/client/peer.go
index e117ad42..2938096c 100644
--- a/pkg/rpc/dfdaemon/client/peer.go
+++ b/pkg/rpc/dfdaemon/client/peer.go
@@ -21,13 +21,14 @@ import (
 	"fmt"
 	"strings"
 
+	"google.golang.org/grpc"
+
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
 	cdnclient "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/client"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
-	"google.golang.org/grpc"
 )
 
 func GetPieceTasks(ctx context.Context, destPeer *scheduler.PeerPacket_DestPeer, ptr *base.PieceTaskRequest, opts ...grpc.CallOption) (*base.PiecePacket, error) {
diff --git a/pkg/rpc/dfdaemon/server/server.go b/pkg/rpc/dfdaemon/server/server.go
index e05041b1..6210466b 100644
--- a/pkg/rpc/dfdaemon/server/server.go
+++ b/pkg/rpc/dfdaemon/server/server.go
@@ -20,15 +20,16 @@ import (
 	"context"
 	"sync"
 
+	"github.com/golang/protobuf/ptypes/empty"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/peer"
+
 	"d7y.io/dragonfly/v2/internal/dferrors"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"
 	"d7y.io/dragonfly/v2/pkg/safe"
-	"github.com/golang/protobuf/ptypes/empty"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/peer"
 )
 
 // DaemonServer refer to dfdaemon.DaemonServer
diff --git a/pkg/rpc/manager/client/client.go b/pkg/rpc/manager/client/client.go
index f9cbdcff..53e10447 100644
--- a/pkg/rpc/manager/client/client.go
+++ b/pkg/rpc/manager/client/client.go
@@ -20,14 +20,14 @@ import (
 	"context"
 	"time"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/rpc/manager"
-
 	grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
 	grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
 	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/backoff"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/pkg/rpc/manager"
 )
 
 const (
diff --git a/pkg/rpc/manager/server/server.go b/pkg/rpc/manager/server/server.go
index c4c97239..4c79ef0a 100644
--- a/pkg/rpc/manager/server/server.go
+++ b/pkg/rpc/manager/server/server.go
@@ -19,9 +19,6 @@ package server
 import (
 	"context"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/rpc/manager"
-
 	grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
 	grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
 	grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
@@ -29,6 +26,9 @@ import (
 	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 	"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
 	"google.golang.org/grpc"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/pkg/rpc/manager"
 )
 
 var defaultStreamMiddleWares = []grpc.StreamServerInterceptor{
diff --git a/pkg/rpc/scheduler/client/client.go b/pkg/rpc/scheduler/client/client.go
index 971af732..0b9386ee 100644
--- a/pkg/rpc/scheduler/client/client.go
+++ b/pkg/rpc/scheduler/client/client.go
@@ -20,6 +20,11 @@ import (
 	"context"
 	"time"
 
+	"github.com/pkg/errors"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
+
 	"d7y.io/dragonfly/v2/internal/dfcodes"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/idgen"
@@ -27,10 +32,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
-	"github.com/pkg/errors"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/codes"
-	"google.golang.org/grpc/status"
 )
 
 func GetClientByAddr(addrs []dfnet.NetAddr, opts ...grpc.DialOption) (SchedulerClient, error) {
diff --git a/pkg/rpc/scheduler/client/peer_packet_stream.go b/pkg/rpc/scheduler/client/peer_packet_stream.go
index 01574628..30f67c5b 100644
--- a/pkg/rpc/scheduler/client/peer_packet_stream.go
+++ b/pkg/rpc/scheduler/client/peer_packet_stream.go
@@ -19,13 +19,13 @@ package client
 import (
 	"context"
 
-	"d7y.io/dragonfly/v2/internal/dferrors"
-	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"github.com/pkg/errors"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 
+	"d7y.io/dragonfly/v2/internal/dferrors"
+	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/pkg/rpc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go
index e12a76e5..158de2be 100644
--- a/pkg/rpc/server.go
+++ b/pkg/rpc/server.go
@@ -20,16 +20,16 @@ import (
 	"context"
 	"time"
 
-	"d7y.io/dragonfly/v2/internal/dferrors"
-	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
-
 	grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
 	grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
 	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/keepalive"
 	"google.golang.org/grpc/status"
+
+	"d7y.io/dragonfly/v2/internal/dferrors"
+	logger "d7y.io/dragonfly/v2/internal/dflog"
+	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
 )
 
 var DefaultServerOptions = []grpc.ServerOption{
diff --git a/pkg/source/hdfsprotocol/hdfs_source_client.go b/pkg/source/hdfsprotocol/hdfs_source_client.go
index 91da5082..bd0a619d 100644
--- a/pkg/source/hdfsprotocol/hdfs_source_client.go
+++ b/pkg/source/hdfsprotocol/hdfs_source_client.go
@@ -26,13 +26,12 @@ import (
 	"sync"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-
+	"github.com/colinmarc/hdfs/v2"
 	"github.com/go-http-utils/headers"
 	"github.com/pkg/errors"
 
 	"d7y.io/dragonfly/v2/pkg/source"
-	"github.com/colinmarc/hdfs/v2"
+	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 )
 
 const (
diff --git a/pkg/source/httpprotocol/http_source_client.go b/pkg/source/httpprotocol/http_source_client.go
index c630f66b..6325558c 100644
--- a/pkg/source/httpprotocol/http_source_client.go
+++ b/pkg/source/httpprotocol/http_source_client.go
@@ -26,13 +26,12 @@ import (
 	"os"
 	"time"
 
-	"d7y.io/dragonfly/v2/cdn/types"
-	"d7y.io/dragonfly/v2/pkg/util/maputils"
-	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-
 	"github.com/go-http-utils/headers"
 
+	"d7y.io/dragonfly/v2/cdn/types"
 	"d7y.io/dragonfly/v2/pkg/source"
+	"d7y.io/dragonfly/v2/pkg/util/maputils"
+	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 	"d7y.io/dragonfly/v2/pkg/util/timeutils"
 )
diff --git a/pkg/source/ossprotocol/oss_source_client.go b/pkg/source/ossprotocol/oss_source_client.go
index aa5b81bd..0671f253 100644
--- a/pkg/source/ossprotocol/oss_source_client.go
+++ b/pkg/source/ossprotocol/oss_source_client.go
@@ -25,14 +25,14 @@ import (
 	"strconv"
 	"sync"
 
-	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
+	"github.com/aliyun/aliyun-oss-go-sdk/oss"
+	"github.com/go-http-utils/headers"
+	"github.com/pkg/errors"
 
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/pkg/source"
+	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/aliyun/aliyun-oss-go-sdk/oss"
-	"github.com/go-http-utils/headers"
-	"github.com/pkg/errors"
 )
 
 const ossClient = "oss"
diff --git a/pkg/structure/syncmap/syncmap.go b/pkg/structure/syncmap/syncmap.go
index d8fe61e3..cd1c3b29 100644
--- a/pkg/structure/syncmap/syncmap.go
+++ b/pkg/structure/syncmap/syncmap.go
@@ -22,10 +22,11 @@ import (
 	"sync"
 	"time"
 
-	"d7y.io/dragonfly/v2/internal/dferrors"
-	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 	"github.com/pkg/errors"
 	"go.uber.org/atomic"
+
+	"d7y.io/dragonfly/v2/internal/dferrors"
+	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 )
 
 // SyncMap is a thread-safe map providing generic support
diff --git a/pkg/unit/byte.go b/pkg/unit/byte.go
index 7452c035..a28ca1aa 100644
--- a/pkg/unit/byte.go
+++ b/pkg/unit/byte.go
@@ -23,9 +23,10 @@ import (
 	"strconv"
 	"strings"
 
-	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 	"github.com/pkg/errors"
 	"gopkg.in/yaml.v3"
+
+	"d7y.io/dragonfly/v2/pkg/util/stringutils"
 )
 
 type Bytes int64
diff --git a/pkg/util/fileutils/file_utils.go b/pkg/util/fileutils/file_utils.go
index 7f1f24d5..7e132606 100644
--- a/pkg/util/fileutils/file_utils.go
+++ b/pkg/util/fileutils/file_utils.go
@@ -23,10 +23,10 @@ import (
 	"path/filepath"
 	"syscall"
 
-	"d7y.io/dragonfly/v2/pkg/unit"
+	"github.com/pkg/errors"
 
 	logger "d7y.io/dragonfly/v2/internal/dflog"
-	"github.com/pkg/errors"
+	"d7y.io/dragonfly/v2/pkg/unit"
 )
 
 const (
diff --git a/pkg/util/fileutils/filerw/file_rw.go b/pkg/util/fileutils/filerw/file_rw.go
index 130744d5..e5721a9f 100644
--- a/pkg/util/fileutils/filerw/file_rw.go
+++ b/pkg/util/fileutils/filerw/file_rw.go
@@ -20,8 +20,9 @@ import (
 	"io"
 	"os"
 
-	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 	"github.com/pkg/errors"
+
+	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 )
 
 // CopyFile copies the file, not dir, src to dst.
diff --git a/scheduler/core/events.go b/scheduler/core/events.go
index ae9975ba..1fb5a8c9 100644
--- a/scheduler/core/events.go
+++ b/scheduler/core/events.go
@@ -20,6 +20,10 @@ import (
 	"context"
 	"time"
 
+	"go.opentelemetry.io/otel/trace"
+	"k8s.io/apimachinery/pkg/util/sets"
+	"k8s.io/client-go/util/workqueue"
+
 	"d7y.io/dragonfly/v2/internal/dfcodes"
 	"d7y.io/dragonfly/v2/internal/dferrors"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
@@ -28,9 +32,6 @@ import (
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/core/scheduler"
 	"d7y.io/dragonfly/v2/scheduler/supervisor"
-	"go.opentelemetry.io/otel/trace"
-	"k8s.io/apimachinery/pkg/util/sets"
-	"k8s.io/client-go/util/workqueue"
 )
 
 type event interface {
diff --git a/scheduler/core/monitor.go b/scheduler/core/monitor.go
index 577a0b86..bf7cc432 100644
--- a/scheduler/core/monitor.go
+++ b/scheduler/core/monitor.go
@@ -24,10 +24,11 @@ import (
 	"strings"
 	"time"
 
-	"d7y.io/dragonfly/v2/scheduler/supervisor"
 	"github.com/olekukonko/tablewriter"
 	"go.uber.org/zap"
 	"k8s.io/client-go/util/workqueue"
+
+	"d7y.io/dragonfly/v2/scheduler/supervisor"
 )
 
 type monitor struct {
diff --git a/scheduler/core/scheduler/basic/basic_scheduler.go b/scheduler/core/scheduler/basic/basic_scheduler.go
index a824c355..f6bb6482 100644
--- a/scheduler/core/scheduler/basic/basic_scheduler.go
+++ b/scheduler/core/scheduler/basic/basic_scheduler.go
@@ -19,13 +19,14 @@ package basic
 import (
 	"sort"
 
+	"k8s.io/apimachinery/pkg/util/sets"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/core/evaluator"
 	"d7y.io/dragonfly/v2/scheduler/core/evaluator/basic"
 	"d7y.io/dragonfly/v2/scheduler/core/scheduler"
 	"d7y.io/dragonfly/v2/scheduler/supervisor"
-	"k8s.io/apimachinery/pkg/util/sets"
 )
 
 const name = "basic"
diff --git a/scheduler/core/scheduler/scheduler.go b/scheduler/core/scheduler/scheduler.go
index cc1945e4..4df67a69 100644
--- a/scheduler/core/scheduler/scheduler.go
+++ b/scheduler/core/scheduler/scheduler.go
@@ -19,9 +19,10 @@ package scheduler
 import (
 	"strings"
 
+	"k8s.io/apimachinery/pkg/util/sets"
+
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/supervisor"
-	"k8s.io/apimachinery/pkg/util/sets"
 )
 
 type Scheduler interface {
diff --git a/scheduler/job/job.go b/scheduler/job/job.go
index 5a8c03c6..69d98235 100644
--- a/scheduler/job/job.go
+++ b/scheduler/job/job.go
@@ -19,6 +19,10 @@ package job
 import (
 	"context"
 
+	"github.com/go-playground/validator/v10"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/trace"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/idgen"
 	internaljob "d7y.io/dragonfly/v2/internal/job"
@@ -26,9 +30,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/core"
-	"github.com/go-playground/validator/v10"
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/trace"
 )
 
 var tracer = otel.Tracer("worker")
diff --git a/scheduler/supervisor/cdn.go b/scheduler/supervisor/cdn.go
index 5a83366e..5fe350a0 100644
--- a/scheduler/supervisor/cdn.go
+++ b/scheduler/supervisor/cdn.go
@@ -26,19 +26,19 @@ import (
 	"reflect"
 	"sync"
 
+	"github.com/pkg/errors"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/trace"
+	"google.golang.org/grpc"
+
 	"d7y.io/dragonfly/v2/internal/dfcodes"
 	"d7y.io/dragonfly/v2/internal/dferrors"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"d7y.io/dragonfly/v2/internal/idgen"
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem"
-	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/client"
 	cdnclient "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/client"
 	"d7y.io/dragonfly/v2/scheduler/config"
-	"github.com/pkg/errors"
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/trace"
-	"google.golang.org/grpc"
 )
 
 var (
@@ -124,7 +124,7 @@ func (c *cdn) StartSeedTask(ctx context.Context, task *Task) (*Peer, error) {
 	return c.receivePiece(ctx, task, stream)
 }
 
-func (c *cdn) receivePiece(ctx context.Context, task *Task, stream *client.PieceSeedStream) (*Peer, error) {
+func (c *cdn) receivePiece(ctx context.Context, task *Task, stream *cdnclient.PieceSeedStream) (*Peer, error) {
 	span := trace.SpanFromContext(ctx)
 	var initialized bool
 	var cdnPeer *Peer
diff --git a/scheduler/supervisor/host.go b/scheduler/supervisor/host.go
index 83a607de..f881f64f 100644
--- a/scheduler/supervisor/host.go
+++ b/scheduler/supervisor/host.go
@@ -21,8 +21,9 @@ package supervisor
 import (
 	"sync"
 
-	logger "d7y.io/dragonfly/v2/internal/dflog"
 	"go.uber.org/atomic"
+
+	logger "d7y.io/dragonfly/v2/internal/dflog"
 )
 
 type HostManager interface {
diff --git a/scheduler/supervisor/peer.go b/scheduler/supervisor/peer.go
index 8fff4f3f..5adf047d 100644
--- a/scheduler/supervisor/peer.go
+++ b/scheduler/supervisor/peer.go
@@ -22,12 +22,13 @@ import (
 	"sync"
 	"time"
 
+	"github.com/pkg/errors"
+	"go.uber.org/atomic"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	gc "d7y.io/dragonfly/v2/pkg/gc"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 	"d7y.io/dragonfly/v2/scheduler/config"
-	"github.com/pkg/errors"
-	"go.uber.org/atomic"
 )
 
 const (
diff --git a/scheduler/supervisor/task.go b/scheduler/supervisor/task.go
index 8a42803b..f6c31c2e 100644
--- a/scheduler/supervisor/task.go
+++ b/scheduler/supervisor/task.go
@@ -21,12 +21,13 @@ import (
 	"sync"
 	"time"
 
+	"go.uber.org/atomic"
+
 	logger "d7y.io/dragonfly/v2/internal/dflog"
 	gc "d7y.io/dragonfly/v2/pkg/gc"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/structure/sortedlist"
 	"d7y.io/dragonfly/v2/scheduler/config"
-	"go.uber.org/atomic"
 )
 
 const (


Test patch:
diff --git a/cdn/storedriver/local/local_driver_test.go b/cdn/storedriver/local/local_driver_test.go
index 4b00fa2c..3a0cce55 100644
--- a/cdn/storedriver/local/local_driver_test.go
+++ b/cdn/storedriver/local/local_driver_test.go
@@ -26,12 +26,13 @@ import (
 	"syscall"
 	"testing"
 
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/statutils"
-	"github.com/stretchr/testify/suite"
 )
 
 func TestLocalDriverTestSuite(t *testing.T) {
diff --git a/cdn/storedriver/store_mgr_test.go b/cdn/storedriver/store_mgr_test.go
index 20a7c6f5..e91d7cd8 100644
--- a/cdn/storedriver/store_mgr_test.go
+++ b/cdn/storedriver/store_mgr_test.go
@@ -21,9 +21,10 @@ import (
 	"os"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/pkg/unit"
-	"github.com/stretchr/testify/assert"
 )
 
 type mockDriver struct {
diff --git a/cdn/supervisor/cdn/cache_detector_test.go b/cdn/supervisor/cdn/cache_detector_test.go
index 7c856048..b38c580e 100644
--- a/cdn/supervisor/cdn/cache_detector_test.go
+++ b/cdn/supervisor/cdn/cache_detector_test.go
@@ -27,6 +27,9 @@ import (
 	"testing"
 	"time"
 
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/suite"
+
 	cdnerrors "d7y.io/dragonfly/v2/cdn/errors"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
@@ -36,8 +39,6 @@ import (
 	sourceMock "d7y.io/dragonfly/v2/pkg/source/mock"
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
 	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/suite"
 )
 
 func TestCacheDetectorSuite(t *testing.T) {
diff --git a/cdn/supervisor/cdn/cache_writer_test.go b/cdn/supervisor/cdn/cache_writer_test.go
index 240e3641..0d41b409 100644
--- a/cdn/supervisor/cdn/cache_writer_test.go
+++ b/cdn/supervisor/cdn/cache_writer_test.go
@@ -27,6 +27,8 @@ import (
 	"testing"
 	"time"
 
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/cdn/storedriver"
@@ -36,7 +38,6 @@ import (
 	"d7y.io/dragonfly/v2/cdn/supervisor/progress"
 	"d7y.io/dragonfly/v2/cdn/types"
 	"d7y.io/dragonfly/v2/pkg/unit"
-	"github.com/stretchr/testify/suite"
 )
 
 func TestCacheWriterSuite(t *testing.T) {
diff --git a/cdn/supervisor/cdn/manager_test.go b/cdn/supervisor/cdn/manager_test.go
index 83f9d92f..364c6fe6 100644
--- a/cdn/supervisor/cdn/manager_test.go
+++ b/cdn/supervisor/cdn/manager_test.go
@@ -25,6 +25,9 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/plugins"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
@@ -37,8 +40,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/util/net/urlutils"
 	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 	"d7y.io/dragonfly/v2/pkg/util/timeutils"
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/suite"
 )
 
 func TestCDNManagerSuite(t *testing.T) {
diff --git a/cdn/supervisor/cdn/storage/disk/disk_test.go b/cdn/supervisor/cdn/storage/disk/disk_test.go
index 85085901..57463829 100644
--- a/cdn/supervisor/cdn/storage/disk/disk_test.go
+++ b/cdn/supervisor/cdn/storage/disk/disk_test.go
@@ -20,14 +20,13 @@ import (
 	"fmt"
 	"testing"
 
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/cdn/storedriver"
 	"d7y.io/dragonfly/v2/cdn/supervisor/cdn/storage"
 	"d7y.io/dragonfly/v2/cdn/supervisor/mock"
-	"github.com/golang/mock/gomock"
-
 	"d7y.io/dragonfly/v2/pkg/unit"
-
-	"github.com/stretchr/testify/suite"
 )
 
 func TestDiskStorageMgrSuite(t *testing.T) {
diff --git a/cdn/supervisor/task/manager_test.go b/cdn/supervisor/task/manager_test.go
index 25680bcd..86685853 100644
--- a/cdn/supervisor/task/manager_test.go
+++ b/cdn/supervisor/task/manager_test.go
@@ -20,13 +20,14 @@ import (
 	"context"
 	"testing"
 
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/cdn/config"
 	"d7y.io/dragonfly/v2/cdn/supervisor/mock"
 	"d7y.io/dragonfly/v2/cdn/types"
 	"d7y.io/dragonfly/v2/internal/idgen"
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/suite"
 )
 
 func TestTaskManagerSuite(t *testing.T) {
diff --git a/client/config/peerhost_test.go b/client/config/peerhost_test.go
index 35c666e5..4f36df61 100644
--- a/client/config/peerhost_test.go
+++ b/client/config/peerhost_test.go
@@ -22,13 +22,12 @@ import (
 	"testing"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/unit"
-	"gopkg.in/yaml.v3"
-
 	testifyassert "github.com/stretchr/testify/assert"
+	"gopkg.in/yaml.v3"
 
 	"d7y.io/dragonfly/v2/client/clientutil"
 	"d7y.io/dragonfly/v2/pkg/basic/dfnet"
+	"d7y.io/dragonfly/v2/pkg/unit"
 )
 
 func Test_AllUnmarshalYAML(t *testing.T) {
diff --git a/client/daemon/peer/peertask_file_test.go b/client/daemon/peer/peertask_file_test.go
index 93dc058f..609b7f61 100644
--- a/client/daemon/peer/peertask_file_test.go
+++ b/client/daemon/peer/peertask_file_test.go
@@ -26,19 +26,18 @@ import (
 	"testing"
 	"time"
 
-	"d7y.io/dragonfly/v2/cdn/cdnutil"
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
-	rangers "d7y.io/dragonfly/v2/pkg/util/rangeutils"
-
 	"github.com/golang/mock/gomock"
 	testifyassert "github.com/stretchr/testify/assert"
 
+	"d7y.io/dragonfly/v2/cdn/cdnutil"
 	"d7y.io/dragonfly/v2/client/clientutil"
 	"d7y.io/dragonfly/v2/client/config"
 	"d7y.io/dragonfly/v2/client/daemon/test"
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 	"d7y.io/dragonfly/v2/pkg/source"
 	sourceMock "d7y.io/dragonfly/v2/pkg/source/mock"
+	rangers "d7y.io/dragonfly/v2/pkg/util/rangeutils"
 )
 
 func TestFilePeerTask_BackSource_WithContentLength(t *testing.T) {
diff --git a/client/daemon/rpcserver/rpcserver_test.go b/client/daemon/rpcserver/rpcserver_test.go
index ab33ec60..06e603c4 100644
--- a/client/daemon/rpcserver/rpcserver_test.go
+++ b/client/daemon/rpcserver/rpcserver_test.go
@@ -37,7 +37,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	dfdaemongrpc "d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"
 	dfclient "d7y.io/dragonfly/v2/pkg/rpc/dfdaemon/client"
-	_ "d7y.io/dragonfly/v2/pkg/rpc/dfdaemon/server"
 	dfdaemonserver "d7y.io/dragonfly/v2/pkg/rpc/dfdaemon/server"
 	"d7y.io/dragonfly/v2/pkg/rpc/scheduler"
 )
diff --git a/client/dfget/dfget_test.go b/client/dfget/dfget_test.go
index fd08fb37..8b58ef31 100644
--- a/client/dfget/dfget_test.go
+++ b/client/dfget/dfget_test.go
@@ -24,13 +24,14 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
+
 	"d7y.io/dragonfly/v2/client/config"
 	"d7y.io/dragonfly/v2/internal/idgen"
 	"d7y.io/dragonfly/v2/pkg/source"
 	sourcemock "d7y.io/dragonfly/v2/pkg/source/mock"
 	"d7y.io/dragonfly/v2/pkg/util/digestutils"
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/assert"
 )
 
 func Test_downloadFromSource(t *testing.T) {
diff --git a/internal/dynconfig/dynconfig_test.go b/internal/dynconfig/dynconfig_test.go
index 0eddff23..bfa4a9ca 100644
--- a/internal/dynconfig/dynconfig_test.go
+++ b/internal/dynconfig/dynconfig_test.go
@@ -23,10 +23,11 @@ import (
 	"testing"
 	"time"
 
-	mock_manager_client "d7y.io/dragonfly/v2/internal/dynconfig/mocks"
 	"github.com/golang/mock/gomock"
 	"github.com/mitchellh/mapstructure"
 	"github.com/stretchr/testify/assert"
+
+	mock_manager_client "d7y.io/dragonfly/v2/internal/dynconfig/mocks"
 )
 
 type TestDynconfig struct {
diff --git a/internal/idgen/task_id_test.go b/internal/idgen/task_id_test.go
index d3fa14ee..88b52be4 100644
--- a/internal/idgen/task_id_test.go
+++ b/internal/idgen/task_id_test.go
@@ -19,8 +19,9 @@ package idgen
 import (
 	"testing"
 
-	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/pkg/rpc/base"
 )
 
 func TestTaskID(t *testing.T) {
diff --git a/internal/job/job_test.go b/internal/job/job_test.go
index 12042684..0c3d3349 100644
--- a/internal/job/job_test.go
+++ b/internal/job/job_test.go
@@ -20,9 +20,8 @@ import (
 	"reflect"
 	"testing"
 
-	"github.com/stretchr/testify/assert"
-
 	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+	"github.com/stretchr/testify/assert"
 )
 
 func TestJobMarshal(t *testing.T) {
diff --git a/manager/searcher/searcher_test.go b/manager/searcher/searcher_test.go
index 94201073..a4c9e070 100644
--- a/manager/searcher/searcher_test.go
+++ b/manager/searcher/searcher_test.go
@@ -19,8 +19,9 @@ package searcher
 import (
 	"testing"
 
-	"d7y.io/dragonfly/v2/manager/model"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/manager/model"
 )
 
 func TestSchedulerCluster(t *testing.T) {
diff --git a/pkg/gc/gc_test.go b/pkg/gc/gc_test.go
index fd7c21f6..2c51e473 100644
--- a/pkg/gc/gc_test.go
+++ b/pkg/gc/gc_test.go
@@ -22,9 +22,10 @@ import (
 	"testing"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/gc/mocks"
 	"github.com/golang/mock/gomock"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/pkg/gc/mocks"
 )
 
 func TestGCAdd(t *testing.T) {
diff --git a/pkg/source/hdfsprotocol/hdfs_source_client_test.go b/pkg/source/hdfsprotocol/hdfs_source_client_test.go
index 41a11dc1..4cc1caad 100644
--- a/pkg/source/hdfsprotocol/hdfs_source_client_test.go
+++ b/pkg/source/hdfsprotocol/hdfs_source_client_test.go
@@ -26,15 +26,15 @@ import (
 	"testing"
 	"time"
 
-	"d7y.io/dragonfly/v2/cdn/supervisor/cdn"
-	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
-
-	"d7y.io/dragonfly/v2/pkg/source"
 	"github.com/agiledragon/gomonkey"
 	"github.com/colinmarc/hdfs/v2"
 	"github.com/go-http-utils/headers"
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/cdn/supervisor/cdn"
+	"d7y.io/dragonfly/v2/pkg/source"
+	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 )
 
 var sourceClient source.ResourceClient
diff --git a/pkg/source/httpprotocol/http_source_client_test.go b/pkg/source/httpprotocol/http_source_client_test.go
index 2993749e..584e4a9b 100644
--- a/pkg/source/httpprotocol/http_source_client_test.go
+++ b/pkg/source/httpprotocol/http_source_client_test.go
@@ -25,11 +25,12 @@ import (
 	"testing"
 	"time"
 
-	"d7y.io/dragonfly/v2/pkg/source"
-	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 	"github.com/go-http-utils/headers"
 	"github.com/jarcoal/httpmock"
 	"github.com/stretchr/testify/suite"
+
+	"d7y.io/dragonfly/v2/pkg/source"
+	"d7y.io/dragonfly/v2/pkg/util/rangeutils"
 )
 
 func TestHTTPSourceClientTestSuite(t *testing.T) {
diff --git a/pkg/util/digestutils/digest_test.go b/pkg/util/digestutils/digest_test.go
index ae131ce9..73669fb6 100644
--- a/pkg/util/digestutils/digest_test.go
+++ b/pkg/util/digestutils/digest_test.go
@@ -22,10 +22,11 @@ import (
 	"syscall"
 	"testing"
 
-	"d7y.io/dragonfly/v2/pkg/basic"
-	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 	"github.com/google/uuid"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/pkg/basic"
+	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 )
 
 func TestSha256(t *testing.T) {
diff --git a/pkg/util/fileutils/test/file_utils_test.go b/pkg/util/fileutils/test/file_utils_test.go
index 566c0d95..fa5fe07f 100644
--- a/pkg/util/fileutils/test/file_utils_test.go
+++ b/pkg/util/fileutils/test/file_utils_test.go
@@ -24,15 +24,16 @@ import (
 	"syscall"
 	"testing"
 
+	"github.com/google/uuid"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/suite"
+
 	"d7y.io/dragonfly/v2/pkg/basic"
 	"d7y.io/dragonfly/v2/pkg/unit"
 	"d7y.io/dragonfly/v2/pkg/util/fileutils"
 	"d7y.io/dragonfly/v2/pkg/util/fileutils/filerw"
 	"d7y.io/dragonfly/v2/pkg/util/statutils"
 	"d7y.io/dragonfly/v2/pkg/util/stringutils"
-	"github.com/google/uuid"
-	"github.com/stretchr/testify/assert"
-	"github.com/stretchr/testify/suite"
 )
 
 type FileUtilsTestSuite struct {
diff --git a/scheduler/config/config_test.go b/scheduler/config/config_test.go
index b7ac0e37..bc13309f 100644
--- a/scheduler/config/config_test.go
+++ b/scheduler/config/config_test.go
@@ -23,7 +23,6 @@ import (
 	"time"
 
 	"github.com/mitchellh/mapstructure"
-	"github.com/stretchr/testify/assert"
 	testifyassert "github.com/stretchr/testify/assert"
 	"gopkg.in/yaml.v3"
 
@@ -106,7 +105,7 @@ func TestConvert(t *testing.T) {
 				},
 			},
 			expect: func(t *testing.T, cfg *Config, err error) {
-				assert := assert.New(t)
+				assert := testifyassert.New(t)
 				assert.Equal("127.0.0.1", cfg.Job.Redis.Host)
 			},
 		},
@@ -123,7 +122,7 @@ func TestConvert(t *testing.T) {
 				},
 			},
 			expect: func(t *testing.T, cfg *Config, err error) {
-				assert := assert.New(t)
+				assert := testifyassert.New(t)
 				assert.Equal("111.111.11.1", cfg.Job.Redis.Host)
 			},
 		},
@@ -140,7 +139,7 @@ func TestConvert(t *testing.T) {
 				},
 			},
 			expect: func(t *testing.T, cfg *Config, err error) {
-				assert := assert.New(t)
+				assert := testifyassert.New(t)
 				assert.Equal("111.111.11.1", cfg.Job.Redis.Host)
 			},
 		},
@@ -157,7 +156,7 @@ func TestConvert(t *testing.T) {
 				},
 			},
 			expect: func(t *testing.T, cfg *Config, err error) {
-				assert := assert.New(t)
+				assert := testifyassert.New(t)
 				assert.Equal("", cfg.Job.Redis.Host)
 			},
 		},
@@ -174,7 +173,7 @@ func TestConvert(t *testing.T) {
 				},
 			},
 			expect: func(t *testing.T, cfg *Config, err error) {
-				assert := assert.New(t)
+				assert := testifyassert.New(t)
 				assert.Equal("localhost", cfg.Job.Redis.Host)
 			},
 		},
diff --git a/scheduler/config/dynconfig_test.go b/scheduler/config/dynconfig_test.go
index ca60eff7..a72dc2e1 100644
--- a/scheduler/config/dynconfig_test.go
+++ b/scheduler/config/dynconfig_test.go
@@ -22,12 +22,13 @@ import (
 	"testing"
 	"time"
 
-	dc "d7y.io/dragonfly/v2/internal/dynconfig"
-	"d7y.io/dragonfly/v2/pkg/rpc/manager"
-	"d7y.io/dragonfly/v2/scheduler/config/mocks"
 	"github.com/golang/mock/gomock"
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
+
+	dc "d7y.io/dragonfly/v2/internal/dynconfig"
+	"d7y.io/dragonfly/v2/pkg/rpc/manager"
+	"d7y.io/dragonfly/v2/scheduler/config/mocks"
 )
 
 func TestDynconfigGet_ManagerSourceType(t *testing.T) {
diff --git a/scheduler/supervisor/cdn_test.go b/scheduler/supervisor/cdn_test.go
index 7d9a72b2..927602b2 100644
--- a/scheduler/supervisor/cdn_test.go
+++ b/scheduler/supervisor/cdn_test.go
@@ -26,6 +26,11 @@ import (
 	"reflect"
 	"testing"
 
+	"github.com/agiledragon/gomonkey"
+	"github.com/golang/mock/gomock"
+	"github.com/pkg/errors"
+	"github.com/stretchr/testify/assert"
+
 	"d7y.io/dragonfly/v2/internal/dfcodes"
 	"d7y.io/dragonfly/v2/internal/dferrors"
 	logger "d7y.io/dragonfly/v2/internal/dflog"
@@ -34,10 +39,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/client"
 	"d7y.io/dragonfly/v2/scheduler/supervisor"
 	"d7y.io/dragonfly/v2/scheduler/supervisor/mocks"
-	"github.com/agiledragon/gomonkey"
-	"github.com/golang/mock/gomock"
-	"github.com/pkg/errors"
-	"github.com/stretchr/testify/assert"
 )
 
 var (
diff --git a/scheduler/supervisor/host_test.go b/scheduler/supervisor/host_test.go
index 720cd7b6..8d56fdd9 100644
--- a/scheduler/supervisor/host_test.go
+++ b/scheduler/supervisor/host_test.go
@@ -20,8 +20,9 @@ import (
 	"strconv"
 	"testing"
 
-	"d7y.io/dragonfly/v2/scheduler/supervisor"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/scheduler/supervisor"
 )
 
 func TestHost_New(t *testing.T) {
diff --git a/scheduler/supervisor/peer_test.go b/scheduler/supervisor/peer_test.go
index 8995846b..77e8daa6 100644
--- a/scheduler/supervisor/peer_test.go
+++ b/scheduler/supervisor/peer_test.go
@@ -20,13 +20,13 @@ import (
 	"strconv"
 	"testing"
 
-	"d7y.io/dragonfly/v2/scheduler/config"
-	"d7y.io/dragonfly/v2/scheduler/supervisor"
-	"d7y.io/dragonfly/v2/scheduler/supervisor/mocks"
-
 	"github.com/golang/mock/gomock"
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
+
+	"d7y.io/dragonfly/v2/scheduler/config"
+	"d7y.io/dragonfly/v2/scheduler/supervisor"
+	"d7y.io/dragonfly/v2/scheduler/supervisor/mocks"
 )
 
 func TestPeer_New(t *testing.T) {
diff --git a/scheduler/supervisor/task_test.go b/scheduler/supervisor/task_test.go
index 33ea01f1..22919ae7 100644
--- a/scheduler/supervisor/task_test.go
+++ b/scheduler/supervisor/task_test.go
@@ -20,13 +20,14 @@ import (
 	"strconv"
 	"testing"
 
+	"github.com/golang/mock/gomock"
+	"github.com/pkg/errors"
+	"github.com/stretchr/testify/assert"
+
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/supervisor"
 	"d7y.io/dragonfly/v2/scheduler/supervisor/mocks"
-	"github.com/golang/mock/gomock"
-	"github.com/pkg/errors"
-	"github.com/stretchr/testify/assert"
 )
 
 func TestTask_New(t *testing.T) {
diff --git a/test/e2e/concurrency_test.go b/test/e2e/concurrency_test.go
index 8cc00996..b97fad01 100644
--- a/test/e2e/concurrency_test.go
+++ b/test/e2e/concurrency_test.go
@@ -19,9 +19,10 @@ package e2e
 import (
 	"fmt"
 
-	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 	. "github.com/onsi/ginkgo" //nolint
 	. "github.com/onsi/gomega" //nolint
+
+	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 )
 
 var _ = Describe("Download concurrency", func() {
diff --git a/test/e2e/containerd_test.go b/test/e2e/containerd_test.go
index 0c185935..3c48afd6 100644
--- a/test/e2e/containerd_test.go
+++ b/test/e2e/containerd_test.go
@@ -19,9 +19,10 @@ package e2e
 import (
 	"fmt"
 
-	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 	. "github.com/onsi/ginkgo" //nolint
 	. "github.com/onsi/gomega" //nolint
+
+	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 )
 
 var _ = Describe("Containerd with CRI support", func() {
diff --git a/test/e2e/dfget_test.go b/test/e2e/dfget_test.go
index 45dce33d..52b5c2ac 100644
--- a/test/e2e/dfget_test.go
+++ b/test/e2e/dfget_test.go
@@ -20,9 +20,10 @@ import (
 	"fmt"
 	"strings"
 
-	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 	. "github.com/onsi/ginkgo" //nolint
 	. "github.com/onsi/gomega" //nolint
+
+	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 )
 
 var _ = Describe("Download with dfget", func() {
diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go
index 84e6a8cd..7146e98b 100644
--- a/test/e2e/e2e_test.go
+++ b/test/e2e/e2e_test.go
@@ -22,10 +22,10 @@ import (
 	"strings"
 	"testing"
 
-	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 	. "github.com/onsi/ginkgo" //nolint
 	. "github.com/onsi/gomega" //nolint
 
+	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
 	_ "d7y.io/dragonfly/v2/test/e2e/manager"
 )
 
diff --git a/test/e2e/manager/preheat.go b/test/e2e/manager/preheat.go
index 00d4e35e..3720b2bf 100644
--- a/test/e2e/manager/preheat.go
+++ b/test/e2e/manager/preheat.go
@@ -24,6 +24,10 @@ import (
 	"strings"
 	"time"
 
+	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
+	. "github.com/onsi/ginkgo" //nolint
+	. "github.com/onsi/gomega" //nolint
+
 	"d7y.io/dragonfly/v2/internal/idgen"
 	internaljob "d7y.io/dragonfly/v2/internal/job"
 	"d7y.io/dragonfly/v2/manager/model"
@@ -31,9 +35,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/util/structutils"
 	"d7y.io/dragonfly/v2/test/e2e/e2eutil"
-	machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks"
-	. "github.com/onsi/ginkgo" //nolint
-	. "github.com/onsi/gomega" //nolint
 )
 
 var _ = Describe("Preheat with manager", func() {