You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2020/12/27 05:15:40 UTC

[dubbo-go] branch imp/lint created (now 0fe61e6)

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

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


      at 0fe61e6  lint

This branch includes the following new commits:

     new f002d8a  Merge pull request #958 from yakecanlee/feature/fix-tracing-filter
     new 0fe61e6  lint

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[dubbo-go] 02/02: lint

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0fe61e6416a11a910294de395d83b59e60e54920
Author: AlexStocks <al...@foxmail.com>
AuthorDate: Sun Dec 27 13:15:22 2020 +0800

    lint
---
 cluster/router/tag/tag_router_test.go              |   2 +-
 config_center/nacos/client.go                      |   5 +-
 protocol/dubbo/hessian2/const.go                   |   8 +-
 protocol/dubbo/impl/const.go                       | 247 ++++++++++-----------
 .../grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go    |   6 +-
 5 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/cluster/router/tag/tag_router_test.go b/cluster/router/tag/tag_router_test.go
index 3f7b979..a2269c6 100644
--- a/cluster/router/tag/tag_router_test.go
+++ b/cluster/router/tag/tag_router_test.go
@@ -74,7 +74,7 @@ const (
 
 var (
 	zkFormat        = "zookeeper://%s:%d"
-	conditionFormat = "condition://%s/com.foo.BarService"
+	//conditionFormat = "condition://%s/com.foo.BarService"
 )
 
 // MockInvoker is only mock the Invoker to support test tagRouter
diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go
index f3942c0..43c8959 100644
--- a/config_center/nacos/client.go
+++ b/config_center/nacos/client.go
@@ -18,7 +18,6 @@
 package nacos
 
 import (
-	"path/filepath"
 	"strconv"
 	"strings"
 	"sync"
@@ -39,7 +38,9 @@ import (
 )
 
 // Nacos Log dir, it can be override when creating client by config_center.log_dir
-var logDir = filepath.Join("logs", "nacos", "log")
+//var (
+//	logDir = filepath.Join("logs", "nacos", "log")
+//)
 
 // NacosClient Nacos client
 type NacosClient struct {
diff --git a/protocol/dubbo/hessian2/const.go b/protocol/dubbo/hessian2/const.go
index 74a00b6..adc64e8 100644
--- a/protocol/dubbo/hessian2/const.go
+++ b/protocol/dubbo/hessian2/const.go
@@ -84,10 +84,10 @@ const (
 	BC_LIST_FIXED              = byte('V')
 	BC_LIST_VARIABLE_UNTYPED   = byte(0x57)
 	BC_LIST_FIXED_UNTYPED      = byte(0x58)
-	_listFixedTypedLenTagMin   = byte(0x70)
-	_listFixedTypedLenTagMax   = byte(0x77)
-	_listFixedUntypedLenTagMin = byte(0x78)
-	_listFixedUntypedLenTagMax = byte(0x7f)
+	//_listFixedTypedLenTagMin   = byte(0x70)
+	//_listFixedTypedLenTagMax   = byte(0x77)
+	//_listFixedUntypedLenTagMin = byte(0x78)
+	//_listFixedUntypedLenTagMax = byte(0x7f)
 
 	BC_LIST_DIRECT         = byte(0x70)
 	BC_LIST_DIRECT_UNTYPED = byte(0x78)
diff --git a/protocol/dubbo/impl/const.go b/protocol/dubbo/impl/const.go
index 70d8bae..27b8835 100644
--- a/protocol/dubbo/impl/const.go
+++ b/protocol/dubbo/impl/const.go
@@ -28,10 +28,10 @@ const (
 	DUBBO = "dubbo"
 )
 
-const (
-	mask = byte(127)
-	flag = byte(128)
-)
+//const (
+//	mask = byte(127)
+//	flag = byte(128)
+//)
 
 const (
 	// Zero : byte zero
@@ -40,111 +40,111 @@ const (
 
 // constansts
 const (
-	TAG_READ        = int32(-1)
-	ASCII_GAP       = 32
-	CHUNK_SIZE      = 4096
-	BC_BINARY       = byte('B') // final chunk
-	BC_BINARY_CHUNK = byte('A') // non-final chunk
-
-	BC_BINARY_DIRECT  = byte(0x20) // 1-byte length binary
-	BINARY_DIRECT_MAX = byte(0x0f)
-	BC_BINARY_SHORT   = byte(0x34) // 2-byte length binary
-	BINARY_SHORT_MAX  = 0x3ff      // 0-1023 binary
-
-	BC_DATE        = byte(0x4a) // 64-bit millisecond UTC date
-	BC_DATE_MINUTE = byte(0x4b) // 32-bit minute UTC date
-
-	BC_DOUBLE = byte('D') // IEEE 64-bit double
-
-	BC_DOUBLE_ZERO  = byte(0x5b)
-	BC_DOUBLE_ONE   = byte(0x5c)
-	BC_DOUBLE_BYTE  = byte(0x5d)
-	BC_DOUBLE_SHORT = byte(0x5e)
-	BC_DOUBLE_MILL  = byte(0x5f)
-
-	BC_FALSE = byte('F') // boolean false
-
-	BC_INT = byte('I') // 32-bit int
-
-	INT_DIRECT_MIN = -0x10
-	INT_DIRECT_MAX = byte(0x2f)
-	BC_INT_ZERO    = byte(0x90)
-
-	INT_BYTE_MIN     = -0x800
-	INT_BYTE_MAX     = 0x7ff
-	BC_INT_BYTE_ZERO = byte(0xc8)
-
-	BC_END = byte('Z')
-
-	INT_SHORT_MIN     = -0x40000
-	INT_SHORT_MAX     = 0x3ffff
-	BC_INT_SHORT_ZERO = byte(0xd4)
-
-	BC_LIST_VARIABLE           = byte(0x55)
-	BC_LIST_FIXED              = byte('V')
-	BC_LIST_VARIABLE_UNTYPED   = byte(0x57)
-	BC_LIST_FIXED_UNTYPED      = byte(0x58)
-	_listFixedTypedLenTagMin   = byte(0x70)
-	_listFixedTypedLenTagMax   = byte(0x77)
-	_listFixedUntypedLenTagMin = byte(0x78)
-	_listFixedUntypedLenTagMax = byte(0x7f)
-
-	BC_LIST_DIRECT         = byte(0x70)
-	BC_LIST_DIRECT_UNTYPED = byte(0x78)
-	LIST_DIRECT_MAX        = byte(0x7)
-
-	BC_LONG         = byte('L') // 64-bit signed integer
-	LONG_DIRECT_MIN = -0x08
-	LONG_DIRECT_MAX = byte(0x0f)
-	BC_LONG_ZERO    = byte(0xe0)
-
-	LONG_BYTE_MIN     = -0x800
-	LONG_BYTE_MAX     = 0x7ff
-	BC_LONG_BYTE_ZERO = byte(0xf8)
-
-	LONG_SHORT_MIN     = -0x40000
-	LONG_SHORT_MAX     = 0x3ffff
-	BC_LONG_SHORT_ZERO = byte(0x3c)
-
-	BC_LONG_INT = byte(0x59)
-
-	BC_MAP         = byte('M')
-	BC_MAP_UNTYPED = byte('H')
-
-	BC_NULL = byte('N') // x4e
-
-	BC_OBJECT     = byte('O')
-	BC_OBJECT_DEF = byte('C')
-
-	BC_OBJECT_DIRECT  = byte(0x60)
-	OBJECT_DIRECT_MAX = byte(0x0f)
-
-	BC_REF = byte(0x51)
-
-	BC_STRING       = byte('S') // final string
-	BC_STRING_CHUNK = byte('R') // non-final string
-
-	BC_STRING_DIRECT  = byte(0x00)
-	STRING_DIRECT_MAX = byte(0x1f)
-	BC_STRING_SHORT   = byte(0x30)
-	STRING_SHORT_MAX  = 0x3ff
-
-	BC_TRUE = byte('T')
-
-	P_PACKET_CHUNK = byte(0x4f)
-	P_PACKET       = byte('P')
-
-	P_PACKET_DIRECT   = byte(0x80)
-	PACKET_DIRECT_MAX = byte(0x7f)
-
-	P_PACKET_SHORT   = byte(0x70)
-	PACKET_SHORT_MAX = 0xfff
-	ARRAY_STRING     = "[string"
-	ARRAY_INT        = "[int"
-	ARRAY_DOUBLE     = "[double"
-	ARRAY_FLOAT      = "[float"
-	ARRAY_BOOL       = "[boolean"
-	ARRAY_LONG       = "[long"
+	//TAG_READ        = int32(-1)
+	//ASCII_GAP       = 32
+	//CHUNK_SIZE      = 4096
+	//BC_BINARY       = byte('B') // final chunk
+	//BC_BINARY_CHUNK = byte('A') // non-final chunk
+	//
+	//BC_BINARY_DIRECT  = byte(0x20) // 1-byte length binary
+	//BINARY_DIRECT_MAX = byte(0x0f)
+	//BC_BINARY_SHORT   = byte(0x34) // 2-byte length binary
+	//BINARY_SHORT_MAX  = 0x3ff      // 0-1023 binary
+	//
+	//BC_DATE        = byte(0x4a) // 64-bit millisecond UTC date
+	//BC_DATE_MINUTE = byte(0x4b) // 32-bit minute UTC date
+	//
+	//BC_DOUBLE = byte('D') // IEEE 64-bit double
+	//
+	//BC_DOUBLE_ZERO  = byte(0x5b)
+	//BC_DOUBLE_ONE   = byte(0x5c)
+	//BC_DOUBLE_BYTE  = byte(0x5d)
+	//BC_DOUBLE_SHORT = byte(0x5e)
+	//BC_DOUBLE_MILL  = byte(0x5f)
+	//
+	//BC_FALSE = byte('F') // boolean false
+	//
+	//BC_INT = byte('I') // 32-bit int
+	//
+	//INT_DIRECT_MIN = -0x10
+	//INT_DIRECT_MAX = byte(0x2f)
+	//BC_INT_ZERO    = byte(0x90)
+	//
+	//INT_BYTE_MIN     = -0x800
+	//INT_BYTE_MAX     = 0x7ff
+	//BC_INT_BYTE_ZERO = byte(0xc8)
+	//
+	//BC_END = byte('Z')
+	//
+	//INT_SHORT_MIN     = -0x40000
+	//INT_SHORT_MAX     = 0x3ffff
+	//BC_INT_SHORT_ZERO = byte(0xd4)
+	//
+	//BC_LIST_VARIABLE           = byte(0x55)
+	//BC_LIST_FIXED              = byte('V')
+	//BC_LIST_VARIABLE_UNTYPED   = byte(0x57)
+	//BC_LIST_FIXED_UNTYPED      = byte(0x58)
+	//_listFixedTypedLenTagMin   = byte(0x70)
+	//_listFixedTypedLenTagMax   = byte(0x77)
+	//_listFixedUntypedLenTagMin = byte(0x78)
+	//_listFixedUntypedLenTagMax = byte(0x7f)
+	//
+	//BC_LIST_DIRECT         = byte(0x70)
+	//BC_LIST_DIRECT_UNTYPED = byte(0x78)
+	//LIST_DIRECT_MAX        = byte(0x7)
+	//
+	//BC_LONG         = byte('L') // 64-bit signed integer
+	//LONG_DIRECT_MIN = -0x08
+	//LONG_DIRECT_MAX = byte(0x0f)
+	//BC_LONG_ZERO    = byte(0xe0)
+	//
+	//LONG_BYTE_MIN     = -0x800
+	//LONG_BYTE_MAX     = 0x7ff
+	//BC_LONG_BYTE_ZERO = byte(0xf8)
+	//
+	//LONG_SHORT_MIN     = -0x40000
+	//LONG_SHORT_MAX     = 0x3ffff
+	//BC_LONG_SHORT_ZERO = byte(0x3c)
+	//
+	//BC_LONG_INT = byte(0x59)
+	//
+	//BC_MAP         = byte('M')
+	//BC_MAP_UNTYPED = byte('H')
+	//
+	//BC_NULL = byte('N') // x4e
+	//
+	//BC_OBJECT     = byte('O')
+	//BC_OBJECT_DEF = byte('C')
+	//
+	//BC_OBJECT_DIRECT  = byte(0x60)
+	//OBJECT_DIRECT_MAX = byte(0x0f)
+	//
+	//BC_REF = byte(0x51)
+	//
+	//BC_STRING       = byte('S') // final string
+	//BC_STRING_CHUNK = byte('R') // non-final string
+	//
+	//BC_STRING_DIRECT  = byte(0x00)
+	//STRING_DIRECT_MAX = byte(0x1f)
+	//BC_STRING_SHORT   = byte(0x30)
+	//STRING_SHORT_MAX  = 0x3ff
+	//
+	//BC_TRUE = byte('T')
+	//
+	//P_PACKET_CHUNK = byte(0x4f)
+	//P_PACKET       = byte('P')
+	//
+	//P_PACKET_DIRECT   = byte(0x80)
+	//PACKET_DIRECT_MAX = byte(0x7f)
+	//
+	//P_PACKET_SHORT   = byte(0x70)
+	//PACKET_SHORT_MAX = 0xfff
+	//ARRAY_STRING     = "[string"
+	//ARRAY_INT        = "[int"
+	//ARRAY_DOUBLE     = "[double"
+	//ARRAY_FLOAT      = "[float"
+	//ARRAY_BOOL       = "[boolean"
+	//ARRAY_LONG       = "[long"
 
 	PATH_KEY      = "path"
 	GROUP_KEY     = "group"
@@ -152,24 +152,24 @@ const (
 	VERSION_KEY   = "version"
 	TIMEOUT_KEY   = "timeout"
 
-	STRING_NIL   = ""
-	STRING_TRUE  = "true"
-	STRING_FALSE = "false"
-	STRING_ZERO  = "0.0"
-	STRING_ONE   = "1.0"
+	//STRING_NIL   = ""
+	//STRING_TRUE  = "true"
+	//STRING_FALSE = "false"
+	//STRING_ZERO  = "0.0"
+	//STRING_ONE   = "1.0"
 )
 
 // ResponsePayload related consts
 const (
 	Response_OK                byte = 20
-	Response_CLIENT_TIMEOUT    byte = 30
-	Response_SERVER_TIMEOUT    byte = 31
-	Response_BAD_REQUEST       byte = 40
-	Response_BAD_RESPONSE      byte = 50
-	Response_SERVICE_NOT_FOUND byte = 60
-	Response_SERVICE_ERROR     byte = 70
-	Response_SERVER_ERROR      byte = 80
-	Response_CLIENT_ERROR      byte = 90
+	//Response_CLIENT_TIMEOUT    byte = 30
+	//Response_SERVER_TIMEOUT    byte = 31
+	//Response_BAD_REQUEST       byte = 40
+	//Response_BAD_RESPONSE      byte = 50
+	//Response_SERVICE_NOT_FOUND byte = 60
+	//Response_SERVICE_ERROR     byte = 70
+	//Response_SERVER_ERROR      byte = 80
+	//Response_CLIENT_ERROR      byte = 90
 
 	// According to "java dubbo" There are two cases of response:
 	// 		1. with attachments
@@ -195,7 +195,7 @@ const (
 	HEADER_LENGTH = 16
 
 	// magic header
-	MAGIC      = uint16(0xdabb)
+	//MAGIC      = uint16(0xdabb)
 	MAGIC_HIGH = byte(0xda)
 	MAGIC_LOW  = byte(0xbb)
 
@@ -205,7 +205,6 @@ const (
 	FLAG_EVENT   = byte(0x20) // for heartbeat
 	SERIAL_MASK  = 0x1f
 
-	DUBBO_VERSION                          = "2.5.4"
 	DUBBO_VERSION_KEY                      = "dubbo"
 	DEFAULT_DUBBO_PROTOCOL_VERSION         = "2.0.2" // Dubbo RPC protocol version, for compatibility, it must not be between 2.0.10 ~ 2.6.2
 	LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200
diff --git a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go
index a9f50e8..4975dce 100644
--- a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go
+++ b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go
@@ -32,15 +32,15 @@ import (
 // It is incremented whenever an incompatibility between the generated code and
 // the grpc package is introduced; the generated code references
 // a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion).
-const generatedCodeVersion = 4
+//const generatedCodeVersion = 4
 
 // Paths for packages used by code generated in this file,
 // relative to the import_prefix of the generator.Generator.
 const (
 	contextPkgPath = "context"
 	grpcPkgPath    = "google.golang.org/grpc"
-	codePkgPath    = "google.golang.org/grpc/codes"
-	statusPkgPath  = "google.golang.org/grpc/status"
+	//codePkgPath    = "google.golang.org/grpc/codes"
+	//statusPkgPath  = "google.golang.org/grpc/status"
 )
 
 func init() {


[dubbo-go] 01/02: Merge pull request #958 from yakecanlee/feature/fix-tracing-filter

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f002d8a7add00d609c1db761c763dbff83cdba40
Merge: de2dad9 44f7199
Author: Xin.Zh <dr...@foxmail.com>
AuthorDate: Sat Dec 26 07:21:30 2020 +0800

    Merge pull request #958 from yakecanlee/feature/fix-tracing-filter
    
    Fix: fix the wrong judgment in rpc result error

 .github/workflows/github-actions.yml | 7 ++++++-
 filter/filter_impl/tracing_filter.go | 2 +-
 go.mod                               | 1 +
 go.sum                               | 2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --cc .github/workflows/github-actions.yml
index 76aa42d,76aa42d..7b082d1
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@@ -54,11 -54,11 +54,16 @@@ jobs
              go get -v -t -d ./...
          fi
  
++    - name: Install go ci lint
++      run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0
++
++    - name: Run Linter
++      run: golangci-lint run --timeout=10m -v
++
      - name: Verify
        run: |
          make verify
  
--
      - name: Integrate Test
        run: |
          chmod +x integrate_test.sh && ./integrate_test.sh
diff --cc go.mod
index 94509de,94509de..2e3f077
--- a/go.mod
+++ b/go.mod
@@@ -39,6 -39,6 +39,7 @@@ require 
  	github.com/stretchr/objx v0.2.0 // indirect
  	github.com/stretchr/testify v1.6.1
  	github.com/zouyx/agollo/v3 v3.4.5
++	go.etcd.io/bbolt v1.3.5 // indirect
  	go.uber.org/atomic v1.7.0
  	go.uber.org/zap v1.16.0
  	google.golang.org/grpc v1.26.0
diff --cc go.sum
index 201f03e,201f03e..afcd5c7
--- a/go.sum
+++ b/go.sum
@@@ -999,6 -999,6 +999,8 @@@ go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyR
  go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
  go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
  go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
++go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
++go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
  go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
  go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
  go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=