Skip to content
Snippets Groups Projects
Commit 0adb3a92 authored by 高辛格's avatar 高辛格
Browse files

go fmt

parent 75641651
No related branches found
No related tags found
No related merge requests found
......@@ -22,14 +22,14 @@ import (
)
import (
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/protocol"
_ "github.com/apache/dubbo-go/filter/impl"
_ "github.com/apache/dubbo-go/cluster/cluster_impl"
_ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/consul"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/impl"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/consul"
_ "github.com/apache/dubbo-go/registry/protocol"
)
func main() {
......
......@@ -18,23 +18,23 @@
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"fmt"
)
import (
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/protocol"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
_ "github.com/apache/dubbo-go/filter/impl"
_ "github.com/apache/dubbo-go/cluster/cluster_impl"
_ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/consul"
"github.com/apache/dubbo-go/config"
"github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/impl"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/consul"
_ "github.com/apache/dubbo-go/registry/protocol"
)
var (
......
......@@ -25,7 +25,7 @@ func init() {
config.SetProviderService(new(DubboService))
}
type DubboService struct {}
type DubboService struct{}
func (s *DubboService) SayHello(message string) (string, error) {
return "hello " + message, nil
......
......@@ -22,9 +22,9 @@ import (
)
import (
perrors "github.com/pkg/errors"
consul "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/api/watch"
perrors "github.com/pkg/errors"
)
import (
......@@ -181,9 +181,9 @@ func (l *consulListener) handler(idx uint64, raw interface{}) {
func (l *consulListener) Next() (*registry.ServiceEvent, error) {
select {
case event := <- l.eventCh:
case event := <-l.eventCh:
return event, nil
case err := <- l.errCh:
case err := <-l.errCh:
return nil, err
}
}
......
......@@ -27,9 +27,9 @@ import (
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/registry"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/registry"
)
func init() {
......@@ -47,7 +47,7 @@ type consulRegistry struct {
// Done field represents whether
// consul registry is closed.
done chan struct{}
done chan struct{}
}
func newConsulRegistry(url *common.URL) (registry.Registry, error) {
......@@ -107,7 +107,7 @@ func (r *consulRegistry) unregister(url common.URL) error {
func (r *consulRegistry) Subscribe(url common.URL) (registry.Listener, error) {
var (
listener registry.Listener
err error
err error
)
role, _ := strconv.Atoi(r.URL.GetParam(constant.ROLE_KEY, ""))
......@@ -131,7 +131,7 @@ func (r *consulRegistry) GetUrl() common.URL {
func (r *consulRegistry) IsAvailable() bool {
select {
case <- r.done:
case <-r.done:
return false
default:
return true
......
......@@ -20,14 +20,14 @@ package consul
import (
"context"
"crypto/md5"
"strconv"
"encoding/hex"
"fmt"
"strconv"
)
import (
perrors "github.com/pkg/errors"
consul "github.com/hashicorp/consul/api"
perrors "github.com/pkg/errors"
)
import (
......@@ -63,7 +63,7 @@ func buildService(url common.URL) (*consul.AgentServiceRegistration, error) {
// tags
tags := make([]string, 0)
for k := range url.Params {
tags = append(tags, k + "=" + url.Params.Get(k))
tags = append(tags, k+"="+url.Params.Get(k))
}
tags = append(tags, "dubbo")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment