Skip to content

Commit

Permalink
chore: update code format by \'make fmt\', add liscence header
Browse files Browse the repository at this point in the history
  • Loading branch information
SHA-4096 committed Jun 18, 2024
1 parent f3eff3b commit 250909d
Show file tree
Hide file tree
Showing 41 changed files with 432 additions and 59 deletions.
5 changes: 5 additions & 0 deletions cluster/cluster/failover/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ package failover
import (
"context"
"fmt"
)

import (
"github.com/dubbogo/gost/log/logger"

perrors "github.com/pkg/errors"
)

import (
"dubbo.apache.org/dubbo-go/v3/cluster/cluster/base"
"dubbo.apache.org/dubbo-go/v3/cluster/directory"
"dubbo.apache.org/dubbo-go/v3/common"
Expand Down
2 changes: 2 additions & 0 deletions cluster/loadbalance/aliasmethod/alias_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package aliasmethod // weighted random with alias-method algorithm

import (
"math/rand"
)

import (
"dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
"dubbo.apache.org/dubbo-go/v3/protocol"
)
Expand Down
7 changes: 6 additions & 1 deletion cluster/loadbalance/aliasmethod/loadbalance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ package aliasmethod
import (
"fmt"
"testing"
)

import (
"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/protocol"
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
"github.com/stretchr/testify/assert"
)

func TestWRAMRoundRobinSelect(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions cluster/loadbalance/iwrr/iwrr.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package iwrr
import (
"math/rand"
"sync"
)

import (
"dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
"dubbo.apache.org/dubbo-go/v3/protocol"
)
Expand Down
7 changes: 6 additions & 1 deletion cluster/loadbalance/iwrr/loadbalance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ package iwrr
import (
"fmt"
"testing"
)

import (
"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/protocol"
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
"github.com/stretchr/testify/assert"
)

func TestIWrrRoundRobinSelect(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions cluster/loadbalance/loadbalance_benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package loadbalance_test
import (
"fmt"
"testing"
)

import (
"dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/aliasmethod"
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/consistenthashing"
Expand Down
10 changes: 6 additions & 4 deletions cluster/router/condition/dynamic_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import (
"sync"
)

import (
"github.com/dubbogo/gost/log/logger"

"gopkg.in/yaml.v2"
)

import (
"dubbo.apache.org/dubbo-go/v3/cluster/utils"
"dubbo.apache.org/dubbo-go/v3/common"
Expand All @@ -34,10 +40,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/config_center"
"dubbo.apache.org/dubbo-go/v3/protocol"
"dubbo.apache.org/dubbo-go/v3/remoting"

"github.com/dubbogo/gost/log/logger"

"gopkg.in/yaml.v2"
)

// for version 3.0-
Expand Down
2 changes: 1 addition & 1 deletion cluster/router/condition/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package condition

import (
"dubbo.apache.org/dubbo-go/v3/remoting"
"testing"
)

Expand All @@ -35,6 +34,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/config_center/configurator"
"dubbo.apache.org/dubbo-go/v3/protocol"
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
"dubbo.apache.org/dubbo-go/v3/remoting"
)

const (
Expand Down
6 changes: 4 additions & 2 deletions cluster/router/script/instance/js_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import (
)

import (
"dubbo.apache.org/dubbo-go/v3/protocol"

"github.com/dop251/goja"
)

import (
"dubbo.apache.org/dubbo-go/v3/protocol"
)

const (
jsScriptResultName = `__go_program_result`
jsScriptPrefix = "\n" + jsScriptResultName + ` = `
Expand Down
12 changes: 7 additions & 5 deletions cluster/router/script/instance/js_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ import (
)

import (
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/protocol"
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"

"github.com/dop251/goja"
_ "github.com/dop251/goja_nodejs/console"
"github.com/dop251/goja_nodejs/require"

"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/protocol"
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
)

var url1 = func() *common.URL {
i, _ := common.NewURL("dubbo:https://127.0.0.1:20000/com.ikurento.user.UserProvider?anyhost=true&" +
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" +
Expand Down
10 changes: 6 additions & 4 deletions cluster/router/script/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import (
"sync"
)

import (
"github.com/dubbogo/gost/log/logger"

"gopkg.in/yaml.v2"
)

import (
ins "dubbo.apache.org/dubbo-go/v3/cluster/router/script/instance"
"dubbo.apache.org/dubbo-go/v3/common"
Expand All @@ -31,10 +37,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/config_center"
"dubbo.apache.org/dubbo-go/v3/protocol"
"dubbo.apache.org/dubbo-go/v3/remoting"

"github.com/dubbogo/gost/log/logger"

"gopkg.in/yaml.v2"
)

// ScriptRouter only takes effect on consumers and only supports application granular management.
Expand Down
4 changes: 3 additions & 1 deletion common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

package constant

import "math"
import (
"math"
)

type DubboCtxKey string

Expand Down
23 changes: 22 additions & 1 deletion common/dubboutil/case_invert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Package server provides APIs for registering services and starting an RPC server.

package dubboutil

import "unicode"
import (
"unicode"
)

func SwapCaseFirstRune(s string) string {
if s == "" {
Expand Down
5 changes: 4 additions & 1 deletion common/rpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package common

import (
"context"
"dubbo.apache.org/dubbo-go/v3/common/dubboutil"
"reflect"
"strings"
"sync"
Expand All @@ -33,6 +32,10 @@ import (
perrors "github.com/pkg/errors"
)

import (
"dubbo.apache.org/dubbo-go/v3/common/dubboutil"
)

// RPCService the type alias of interface{}
type RPCService = interface{}

Expand Down
11 changes: 9 additions & 2 deletions config/config_loader_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ import (
"path/filepath"
"runtime"
"strings"
)

"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/constant/file"
import (
"github.com/dubbogo/gost/log/logger"

"github.com/knadh/koanf"

"github.com/pkg/errors"
)

import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/constant/file"
)

type loaderConf struct {
suffix string // loaderConf file extension default yaml
path string // loaderConf file path default ./conf/dubbogo.yaml
Expand Down
2 changes: 2 additions & 0 deletions config/tls_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import (
"crypto/tls"
"crypto/x509"
"os"
)

import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
)

Expand Down
7 changes: 6 additions & 1 deletion config_center/file/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ import (
"path/filepath"
"runtime"
"strings"
)

import (
gxset "github.com/dubbogo/gost/container/set"

perrors "github.com/pkg/errors"
)

import (
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/config_center"
"dubbo.apache.org/dubbo-go/v3/config_center/parser"
perrors "github.com/pkg/errors"
)

var osType = runtime.GOOS
Expand Down
10 changes: 8 additions & 2 deletions config_center/file/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ package file
import (
"os"
"sync"
)

import (
"github.com/dubbogo/gost/log/logger"

"github.com/fsnotify/fsnotify"
)

import (
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/config_center"
"dubbo.apache.org/dubbo-go/v3/remoting"
"github.com/dubbogo/gost/log/logger"
"github.com/fsnotify/fsnotify"
)

// CacheListener is file watcher
Expand Down
5 changes: 3 additions & 2 deletions filter/sentinel/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ package sentinel

import (
"context"
"github.com/alibaba/sentinel-golang/core/circuitbreaker"
"github.com/pkg/errors"
"sync"
"sync/atomic"
"testing"
"time"
)

import (
"github.com/alibaba/sentinel-golang/core/circuitbreaker"
"github.com/alibaba/sentinel-golang/core/flow"

"github.com/pkg/errors"

"github.com/stretchr/testify/assert"
)

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ require (
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dubbogo/tools v1.0.9 // indirect
github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand Down
Loading

0 comments on commit 250909d

Please sign in to comment.