This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 81fd83d16 ci(fmt): add import-formatter check ci (#2961)
81fd83d16 is described below

commit 81fd83d1603861c003cc935c884678bf2e1b179d
Author: marsevilspirit <[email protected]>
AuthorDate: Thu Jul 31 09:32:27 2025 +0800

    ci(fmt): add import-formatter check ci (#2961)
    
    * ci(fmt): add import-formatter check ci
    
    * fix(fmt): fix import-formatter error
    
    * fix(ci): fix import-formatter ci error
---
 .github/workflows/github-actions.yml               |  3 ++-
 cluster/loadbalance/p2c/loadbalance_test.go        | 11 ++++++++---
 cluster/loadbalance/util.go                        |  2 ++
 common/url.go                                      |  9 ++++++++-
 protocol/triple/client.go                          |  4 ++--
 protocol/triple/options.go                         |  1 -
 protocol/triple/server.go                          |  3 +--
 protocol/triple/triple_protocol/server.go          |  6 +++---
 protocol/triple/triple_protocol/triple_ext_test.go |  2 +-
 registry/nacos/service_discovery.go                | 10 +++++++---
 registry/nacos/service_discovery_test.go           | 14 ++++++++++----
 registry/service_instance.go                       |  6 +++++-
 tls/helper_test.go                                 |  7 ++++++-
 tls/options.go                                     |  1 -
 14 files changed, 55 insertions(+), 24 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index 829c1453c..a1ac2b622 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -82,10 +82,11 @@ jobs:
         else
             go get -v -t -d ./...
         fi
+        go install github.com/dubbogo/tools/cmd/imports-formatter@latest
 
     - name: Format code
       run: |
-        go fmt ./... && git status && [[ -z `git status -s` ]]
+        go fmt ./... && GOROOT=$(go env GOROOT) imports-formatter && git 
status && [[ -z `git status -s` ]]
 
     - name: Verify
       run: |
diff --git a/cluster/loadbalance/p2c/loadbalance_test.go 
b/cluster/loadbalance/p2c/loadbalance_test.go
index 1f4fa034d..489e0a66e 100644
--- a/cluster/loadbalance/p2c/loadbalance_test.go
+++ b/cluster/loadbalance/p2c/loadbalance_test.go
@@ -20,13 +20,18 @@ package p2c
 import (
        "math/rand"
        "testing"
+)
 
-       "dubbo.apache.org/dubbo-go/v3/cluster/metrics"
-       "dubbo.apache.org/dubbo-go/v3/common"
-       "dubbo.apache.org/dubbo-go/v3/protocol/base"
+import (
        "github.com/golang/mock/gomock"
+
        "github.com/stretchr/testify/assert"
+)
 
+import (
+       "dubbo.apache.org/dubbo-go/v3/cluster/metrics"
+       "dubbo.apache.org/dubbo-go/v3/common"
+       "dubbo.apache.org/dubbo-go/v3/protocol/base"
        protoinvoc "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
 )
 
diff --git a/cluster/loadbalance/util.go b/cluster/loadbalance/util.go
index 2eb76fe47..d31d8f2e5 100644
--- a/cluster/loadbalance/util.go
+++ b/cluster/loadbalance/util.go
@@ -19,7 +19,9 @@ package loadbalance
 
 import (
        "time"
+)
 
+import (
        "dubbo.apache.org/dubbo-go/v3/common/constant"
        "dubbo.apache.org/dubbo-go/v3/protocol/base"
 )
diff --git a/common/url.go b/common/url.go
index 34a55c6cc..8da974da0 100644
--- a/common/url.go
+++ b/common/url.go
@@ -28,17 +28,24 @@ import (
        "strings"
        "sync"
        "time"
+)
 
+import (
        cm "github.com/Workiva/go-datastructures/common"
 
        gxset "github.com/dubbogo/gost/container/set"
+
        "github.com/google/uuid"
+
        "github.com/jinzhu/copier"
 
-       "dubbo.apache.org/dubbo-go/v3/common/constant"
        perrors "github.com/pkg/errors"
 )
 
+import (
+       "dubbo.apache.org/dubbo-go/v3/common/constant"
+)
+
 // dubbo role type constant
 const (
        CONSUMER = iota
diff --git a/protocol/triple/client.go b/protocol/triple/client.go
index 34022421c..0ecf8065c 100644
--- a/protocol/triple/client.go
+++ b/protocol/triple/client.go
@@ -34,10 +34,10 @@ import (
 
        "github.com/dustin/go-humanize"
 
-       "golang.org/x/net/http2"
-
        "github.com/quic-go/quic-go"
        "github.com/quic-go/quic-go/http3"
+
+       "golang.org/x/net/http2"
 )
 
 import (
diff --git a/protocol/triple/options.go b/protocol/triple/options.go
index a83164dce..12a97907e 100644
--- a/protocol/triple/options.go
+++ b/protocol/triple/options.go
@@ -27,7 +27,6 @@ import (
 
 // TODO: The triple options for the server and client are mixed together now.
 // We need to find a way to separate them later.
-
 type Options struct {
        Triple *global.TripleConfig
 }
diff --git a/protocol/triple/server.go b/protocol/triple/server.go
index 076b15210..e40626677 100644
--- a/protocol/triple/server.go
+++ b/protocol/triple/server.go
@@ -48,9 +48,8 @@ import (
        "dubbo.apache.org/dubbo-go/v3/protocol/base"
        "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
        "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
-       dubbotls "dubbo.apache.org/dubbo-go/v3/tls"
-
        tri "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+       dubbotls "dubbo.apache.org/dubbo-go/v3/tls"
 )
 
 // Server is TRIPLE adaptation layer representation. It makes use of 
tri.Server to
diff --git a/protocol/triple/triple_protocol/server.go 
b/protocol/triple/triple_protocol/server.go
index a7089220f..e49deadc0 100644
--- a/protocol/triple/triple_protocol/server.go
+++ b/protocol/triple/triple_protocol/server.go
@@ -32,11 +32,11 @@ import (
 
        "github.com/dubbogo/grpc-go"
 
-       "golang.org/x/net/http2"
-       "golang.org/x/net/http2/h2c"
-
        "github.com/quic-go/quic-go"
        "github.com/quic-go/quic-go/http3"
+
+       "golang.org/x/net/http2"
+       "golang.org/x/net/http2/h2c"
 )
 
 import (
diff --git a/protocol/triple/triple_protocol/triple_ext_test.go 
b/protocol/triple/triple_protocol/triple_ext_test.go
index 415be3c83..40a54c2d7 100644
--- a/protocol/triple/triple_protocol/triple_ext_test.go
+++ b/protocol/triple/triple_protocol/triple_ext_test.go
@@ -33,6 +33,7 @@ import (
 
 import (
        "google.golang.org/protobuf/proto"
+
        "google.golang.org/protobuf/reflect/protoregistry"
 )
 
@@ -40,7 +41,6 @@ import (
        triple "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
        
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/assert"
        
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/gen/proto/connect/import/v1/importv1connect"
-
        pingv1 
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/gen/proto/connect/ping/v1"
        
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol/internal/gen/proto/connect/ping/v1/pingv1connect"
 )
diff --git a/registry/nacos/service_discovery.go 
b/registry/nacos/service_discovery.go
index d00c1f5cf..0fc3bdaa5 100644
--- a/registry/nacos/service_discovery.go
+++ b/registry/nacos/service_discovery.go
@@ -23,22 +23,26 @@ import (
        "regexp"
        "strconv"
        "sync"
+)
 
+import (
        gxset "github.com/dubbogo/gost/container/set"
-
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
-
        gxpage "github.com/dubbogo/gost/hash/page"
        "github.com/dubbogo/gost/log/logger"
+
        "github.com/nacos-group/nacos-sdk-go/v2/model"
        "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
+       perrors "github.com/pkg/errors"
+)
+
+import (
        "dubbo.apache.org/dubbo-go/v3/common"
        "dubbo.apache.org/dubbo-go/v3/common/constant"
        "dubbo.apache.org/dubbo-go/v3/common/extension"
        "dubbo.apache.org/dubbo-go/v3/registry"
        "dubbo.apache.org/dubbo-go/v3/remoting/nacos"
-       perrors "github.com/pkg/errors"
 )
 
 const (
diff --git a/registry/nacos/service_discovery_test.go 
b/registry/nacos/service_discovery_test.go
index a9fc833dd..69b7fbd31 100644
--- a/registry/nacos/service_discovery_test.go
+++ b/registry/nacos/service_discovery_test.go
@@ -25,23 +25,29 @@ import (
        "strconv"
        "sync"
        "testing"
+)
 
-       "dubbo.apache.org/dubbo-go/v3/metadata/info"
-
+import (
        gxset "github.com/dubbogo/gost/container/set"
+
        "github.com/nacos-group/nacos-sdk-go/v2/model"
        "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
+       perrors "github.com/pkg/errors"
+
+       "github.com/stretchr/testify/assert"
+)
+
+import (
        "dubbo.apache.org/dubbo-go/v3/common"
        "dubbo.apache.org/dubbo-go/v3/common/constant"
        "dubbo.apache.org/dubbo-go/v3/common/extension"
+       "dubbo.apache.org/dubbo-go/v3/metadata/info"
        "dubbo.apache.org/dubbo-go/v3/protocol/base"
        "dubbo.apache.org/dubbo-go/v3/protocol/result"
        "dubbo.apache.org/dubbo-go/v3/registry"
        "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery"
        "dubbo.apache.org/dubbo-go/v3/remoting/nacos"
-       perrors "github.com/pkg/errors"
-       "github.com/stretchr/testify/assert"
 )
 
 const testName = "test"
diff --git a/registry/service_instance.go b/registry/service_instance.go
index 2ce2e2c4d..4a24906ff 100644
--- a/registry/service_instance.go
+++ b/registry/service_instance.go
@@ -21,13 +21,17 @@ import (
        "encoding/json"
        url2 "net/url"
        "strconv"
+)
 
+import (
        "github.com/dubbogo/gost/log/logger"
+       gxsort "github.com/dubbogo/gost/sort"
+)
 
+import (
        "dubbo.apache.org/dubbo-go/v3/common"
        "dubbo.apache.org/dubbo-go/v3/common/constant"
        "dubbo.apache.org/dubbo-go/v3/metadata/info"
-       gxsort "github.com/dubbogo/gost/sort"
 )
 
 // ServiceInstance is the interface  which is used for service registration 
and discovery.
diff --git a/tls/helper_test.go b/tls/helper_test.go
index d62f4f2ef..05a5d6195 100644
--- a/tls/helper_test.go
+++ b/tls/helper_test.go
@@ -19,11 +19,16 @@ package tls
 
 import (
        "testing"
+)
 
-       "dubbo.apache.org/dubbo-go/v3/global"
+import (
        "github.com/stretchr/testify/assert"
 )
 
+import (
+       "dubbo.apache.org/dubbo-go/v3/global"
+)
+
 func TestIsServerTLSValid(t *testing.T) {
        tests := []struct {
                name     string
diff --git a/tls/options.go b/tls/options.go
index b716416f6..1a12056cc 100644
--- a/tls/options.go
+++ b/tls/options.go
@@ -24,7 +24,6 @@ import (
 // The consideration of not placing TLSOption in the global package is
 // to prevent users from directly using the global package, so I created
 // a new tls directory to allow users to establish config through the tls 
package.
-
 type Options struct {
        TLSConf *global.TLSConfig
 }

Reply via email to