Merge pull request #150 from wongoo/develop
gofumpt format
diff --git a/cmd/admin/admin.go b/cmd/admin/admin.go
index 8233583..5ac09c4 100644
--- a/cmd/admin/admin.go
+++ b/cmd/admin/admin.go
@@ -100,13 +100,13 @@
app.Usage = "Dubbogo pixiu admin"
app.Flags = cmdStart.Flags
- //commands
+ // commands
app.Commands = []cli.Command{
cmdStart,
cmdStop,
}
- //action
+ // action
app.Action = func(c *cli.Context) error {
if c.NumFlags() == 0 {
return cli.ShowAppHelp(c)
@@ -169,7 +169,6 @@
// SetAPIConfig handle modify api config http request
func SetAPIConfig(w http.ResponseWriter, req *http.Request) {
-
body, err := ioutil.ReadAll(req.Body)
if err != nil {
logger.Errorf("read body err, %v\n", err)
diff --git a/cmd/pixiu/pixiu.go b/cmd/pixiu/pixiu.go
index 003faab..c8834b7 100644
--- a/cmd/pixiu/pixiu.go
+++ b/cmd/pixiu/pixiu.go
@@ -59,14 +59,14 @@
app.Usage = "Dubbogo pixiu is a lightweight gateway."
app.Flags = cmdStart.Flags
- //commands
+ // commands
app.Commands = []cli.Command{
cmdStart,
cmdStop,
cmdReload,
}
- //action
+ // action
app.Action = func(c *cli.Context) error {
if c.NumFlags() == 0 {
return cli.ShowAppHelp(c)
diff --git a/pkg/client/dubbo/dubbo.go b/pkg/client/dubbo/dubbo.go
index 906a79a..49f93e3 100644
--- a/pkg/client/dubbo/dubbo.go
+++ b/pkg/client/dubbo/dubbo.go
@@ -153,7 +153,6 @@
gs := dc.Get(dm)
rst, err := gs.Invoke(req.Context, []interface{}{method, types, values})
-
if err != nil {
return nil, err
}
@@ -267,7 +266,7 @@
dc.lock.Lock()
defer dc.lock.Unlock()
referenceConfig.GenericLoad(key)
- time.Sleep(200 * time.Millisecond) //sleep to wait invoker create
+ time.Sleep(200 * time.Millisecond) // sleep to wait invoker create
clientService := referenceConfig.GetRPCService().(*dg.GenericService)
dc.GenericServicePool[key] = clientService
diff --git a/pkg/client/dubbo/option.go b/pkg/client/dubbo/option.go
index 734c5d6..72fbdc1 100644
--- a/pkg/client/dubbo/option.go
+++ b/pkg/client/dubbo/option.go
@@ -139,7 +139,6 @@
// nolint
func (opt *valuesOpt) Action(req *client.Request, val interface{}) {
-
}
func (opt *valuesOpt) VirtualPos() int {
diff --git a/pkg/client/http/http.go b/pkg/client/http/http.go
index eacf5d6..89539f8 100644
--- a/pkg/client/http/http.go
+++ b/pkg/client/http/http.go
@@ -55,8 +55,7 @@
)
// Client client to generic invoke dubbo
-type Client struct {
-}
+type Client struct{}
// SingletonHTTPClient singleton HTTP Client
func SingletonHTTPClient() *Client {
@@ -89,7 +88,7 @@
return nil, err
}
- //Map the origin parameters to backend parameters according to the API configure
+ // Map the origin parameters to backend parameters according to the API configure
transformedParams, err := dc.MapParams(req)
if err != nil {
return nil, err
diff --git a/pkg/client/http/mapper.go b/pkg/client/http/mapper.go
index 73c3b27..59cae76 100644
--- a/pkg/client/http/mapper.go
+++ b/pkg/client/http/mapper.go
@@ -135,7 +135,6 @@
return err
}
if to == constant.RequestURI {
-
}
uriValues := router.GetURIParams(&c.API, *c.IngressRequest.URL)
if uriValues == nil {
@@ -204,7 +203,7 @@
}
if !ok && len(keys) != 1 {
targetMap[keys[0]] = make(map[string]interface{})
- targetMap[keys[0]] = setMapWithPath(targetMap[keys[0]].(map[string]interface{}), strings.Join(keys[1:len(keys)], constant.Dot), val)
+ targetMap[keys[0]] = setMapWithPath(targetMap[keys[0]].(map[string]interface{}), strings.Join(keys[1:], constant.Dot), val)
}
return targetMap
}
diff --git a/pkg/client/http/response.go b/pkg/client/http/response.go
index d88cd67..59d655d 100644
--- a/pkg/client/http/response.go
+++ b/pkg/client/http/response.go
@@ -34,7 +34,6 @@
return &client.Response{Data: data}
}
return &client.Response{Data: r}
-
}
func dealResp(in interface{}, HumpToLine bool) (interface{}, error) {
@@ -119,7 +118,6 @@
// traverse all the keys in the map and change the hump to underline
func humpToLine(in interface{}) interface{} {
-
var m map[string]interface{}
if v, ok := in.(map[string]interface{}); ok {
m = v
@@ -127,7 +125,7 @@
return in
}
- var out = make(map[string]interface{}, len(m))
+ out := make(map[string]interface{}, len(m))
for k1, v1 := range m {
x := humpToUnderline(k1)
@@ -137,7 +135,7 @@
out[x] = humpToLine(struct2Map(v1))
} else if reflect.TypeOf(v1).Kind() == reflect.Slice {
value := reflect.ValueOf(v1)
- var newTemps = make([]interface{}, 0, value.Len())
+ newTemps := make([]interface{}, 0, value.Len())
for i := 0; i < value.Len(); i++ {
newTemp := humpToLine(value.Index(i).Interface())
newTemps = append(newTemps, newTemp)
@@ -173,7 +171,7 @@
t := reflect.TypeOf(obj)
v := reflect.ValueOf(obj)
- var data = make(map[string]interface{})
+ data := make(map[string]interface{})
for i := 0; i < t.NumField(); i++ {
data[t.Field(i).Name] = v.Field(i).Interface()
}
diff --git a/pkg/common/constant/filter.go b/pkg/common/constant/filter.go
index 8353c1a..d818644 100644
--- a/pkg/common/constant/filter.go
+++ b/pkg/common/constant/filter.go
@@ -34,7 +34,7 @@
MessageDateLayout = "2006-01-02 15:04:05"
// nolint
// LogFileMode
- LogFileMode = 0600
+ LogFileMode = 0o600
// nolint
// buffer
LogDataBuffer = 5000
diff --git a/pkg/common/extension/discovery_service.go b/pkg/common/extension/discovery_service.go
index 87a2003..bae41f6 100644
--- a/pkg/common/extension/discovery_service.go
+++ b/pkg/common/extension/discovery_service.go
@@ -21,9 +21,7 @@
"github.com/apache/dubbo-go-pixiu/pkg/service"
)
-var (
- apiDiscoveryServiceMap = map[string]service.APIDiscoveryService{}
-)
+var apiDiscoveryServiceMap = map[string]service.APIDiscoveryService{}
// SetAPIDiscoveryService will store the @filter and @name
func SetAPIDiscoveryService(name string, ads service.APIDiscoveryService) {
diff --git a/pkg/common/extension/filter.go b/pkg/common/extension/filter.go
index 36d5616..904a85f 100644
--- a/pkg/common/extension/filter.go
+++ b/pkg/common/extension/filter.go
@@ -21,9 +21,7 @@
"github.com/dubbogo/dubbo-go-pixiu-filter/pkg/context"
)
-var (
- filterFuncCacheMap = make(map[string]func(ctx context.Context), 4)
-)
+var filterFuncCacheMap = make(map[string]func(ctx context.Context), 4)
// SetFilterFunc will store the @filter and @name
func SetFilterFunc(name string, filter context.FilterFunc) {
diff --git a/pkg/common/yaml/yaml.go b/pkg/common/yaml/yaml.go
index 0e2b3ab..1cf93cf 100644
--- a/pkg/common/yaml/yaml.go
+++ b/pkg/common/yaml/yaml.go
@@ -48,7 +48,7 @@
return yaml.Unmarshal(confFileStream, out)
}
-//UnmarshalYML unmarshals decodes the first document found within the in byte slice and assigns decoded values into the out value.
+// UnmarshalYML unmarshals decodes the first document found within the in byte slice and assigns decoded values into the out value.
func UnmarshalYML(data []byte, out interface{}) error {
return yaml.Unmarshal(data, out)
}
diff --git a/pkg/config/api_config.go b/pkg/config/api_config.go
index 100d800..1a97921 100644
--- a/pkg/config/api_config.go
+++ b/pkg/config/api_config.go
@@ -47,7 +47,7 @@
// APIConfigListener defines api config listener interface
type APIConfigListener interface {
- APIConfigChange(apiConfig fc.APIConfig) bool //bool is return for interface implement is interesting
+ APIConfigChange(apiConfig fc.APIConfig) bool // bool is return for interface implement is interesting
}
// LoadAPIConfigFromFile load the api config from file
@@ -67,7 +67,6 @@
// LoadAPIConfig load the api config from config center
func LoadAPIConfig(metaConfig *model.APIMetaConfig) (*fc.APIConfig, error) {
-
client = etcdv3.NewConfigClient(
etcdv3.WithName(etcdv3.RegistryETCDV3Client),
etcdv3.WithTimeout(10*time.Second),
@@ -77,7 +76,6 @@
go listenAPIConfigNodeEvent(metaConfig.APIConfigPath)
content, err := client.Get(metaConfig.APIConfigPath)
-
if err != nil {
return nil, perrors.Errorf("Get remote config fail error %v", err)
}
diff --git a/pkg/config/config_load.go b/pkg/config/config_load.go
index 7b6b529..476ac68 100644
--- a/pkg/config/config_load.go
+++ b/pkg/config/config_load.go
@@ -186,5 +186,4 @@
log.Fatalln("[config] [default load] json unmarshal config failed, ", err)
}
return cfg
-
}
diff --git a/pkg/context/base_context.go b/pkg/context/base_context.go
index ae76c3a..5744258 100644
--- a/pkg/context/base_context.go
+++ b/pkg/context/base_context.go
@@ -23,9 +23,10 @@
import (
"context"
- "github.com/apache/dubbo-go-pixiu/pkg/client"
"math"
"time"
+
+ "github.com/apache/dubbo-go-pixiu/pkg/client"
)
const abortIndex int8 = math.MaxInt8 / 2
diff --git a/pkg/filter/accesslog/access_log.go b/pkg/filter/accesslog/access_log.go
index 1e01c6a..6a1b40e 100644
--- a/pkg/filter/accesslog/access_log.go
+++ b/pkg/filter/accesslog/access_log.go
@@ -99,7 +99,7 @@
builder.WriteString(fmt.Sprintf(" response [ %+v", string(rbs)))
builder.WriteString("] ")
}
- //builder.WriteString("\n")
+ // builder.WriteString("\n")
return builder.String()
}
diff --git a/pkg/filter/accesslog/access_log_test.go b/pkg/filter/accesslog/access_log_test.go
index 90e71f7..923629b 100644
--- a/pkg/filter/accesslog/access_log_test.go
+++ b/pkg/filter/accesslog/access_log_test.go
@@ -36,7 +36,7 @@
func TestAccessLog_Write_to_file(t *testing.T) {
msg := "this is test msg"
filePath := "dubbo-go-pixiu/logs/dubbo-go-access"
- //filePath := "C:\\Users\\60125\\Desktop\\dubbo-go\\logs\\dubbo-go-pixiu-20201217"
+ // filePath := "C:\\Users\\60125\\Desktop\\dubbo-go\\logs\\dubbo-go-pixiu-20201217"
accessLogWriter := &model.AccessLogWriter{AccessLogDataChan: make(chan model.AccessLogData, constant.LogDataBuffer)}
accessLogWriter.Write()
accessLogWriter.Writer(model.AccessLogData{AccessLogMsg: msg, AccessLogConfig: model.AccessLogConfig{OutPutPath: filePath, Enable: true}})
diff --git a/pkg/filter/authority/authority.go b/pkg/filter/authority/authority.go
index 40a0bc5..2580689 100644
--- a/pkg/filter/authority/authority.go
+++ b/pkg/filter/authority/authority.go
@@ -43,8 +43,7 @@
}
// authorityFilter is a filter for blacklist/whitelist.
-type authorityFilter struct {
-}
+type authorityFilter struct{}
// New create blacklist/whitelist filter.
func New() filter.Filter {
diff --git a/pkg/filter/header/header.go b/pkg/filter/header/header.go
index f383415..eeb42a1 100644
--- a/pkg/filter/header/header.go
+++ b/pkg/filter/header/header.go
@@ -29,8 +29,7 @@
"github.com/apache/dubbo-go-pixiu/pkg/context/http"
)
-type headerFilter struct {
-}
+type headerFilter struct{}
// nolint.
func New() *headerFilter {
@@ -39,7 +38,6 @@
func (h *headerFilter) Do() context.FilterFunc {
return func(c context.Context) {
-
api := c.GetAPI()
headers := api.Headers
if len(headers) <= 0 {
diff --git a/pkg/filter/logger/logger.go b/pkg/filter/logger/logger.go
index bdede4c..c066868 100644
--- a/pkg/filter/logger/logger.go
+++ b/pkg/filter/logger/logger.go
@@ -42,8 +42,7 @@
}
// loggerFilter is a filter for simple logger.
-type loggerFilter struct {
-}
+type loggerFilter struct{}
// New create logger filter.
func New() filter.Filter {
diff --git a/pkg/filter/plugins/plugins.go b/pkg/filter/plugins/plugins.go
index 035a6f3..b9b8e93 100644
--- a/pkg/filter/plugins/plugins.go
+++ b/pkg/filter/plugins/plugins.go
@@ -40,7 +40,7 @@
errEmptyPluginConfig = errors.New("Empty plugin config")
)
-//FilterChain include Pre & Post filters
+// FilterChain include Pre & Post filters
type FilterChain struct {
Pre context.FilterChain
Post context.FilterChain
@@ -55,7 +55,6 @@
// InitPluginsGroup prase api_config.yaml(pluginsGroup) to map[string][]PluginsWithFunc
func InitPluginsGroup(groups []config.PluginsGroup, filePath string) {
-
if "" == filePath || len(groups) == 0 {
return
}
@@ -85,7 +84,6 @@
}
func pairURLWithFilterChain(parentPath string, resources []config.Resource, parentFilterChains *FilterChain) {
-
if len(resources) == 0 {
return
}
@@ -116,7 +114,6 @@
pairURLWithFilterChain(resource.Path, resource.Resources, parentFilterChains)
}
}
-
}
// GetAPIFilterFuncsWithAPIURL is get filterchain with path
diff --git a/pkg/filter/plugins/plugins_test.go b/pkg/filter/plugins/plugins_test.go
index 96e2336..59628e3 100644
--- a/pkg/filter/plugins/plugins_test.go
+++ b/pkg/filter/plugins/plugins_test.go
@@ -28,9 +28,7 @@
"github.com/apache/dubbo-go-pixiu/pkg/config"
)
-var (
- mockFile = "../../config/mock/api_config.yml"
-)
+var mockFile = "../../config/mock/api_config.yml"
func TestInitPluginsGroup(t *testing.T) {
apiConfig, err := config.LoadAPIConfigFromFile(mockFile)
diff --git a/pkg/filter/recovery/recovery.go b/pkg/filter/recovery/recovery.go
index 28eb506..f6a2f9b 100644
--- a/pkg/filter/recovery/recovery.go
+++ b/pkg/filter/recovery/recovery.go
@@ -38,8 +38,7 @@
}
// recoveryFilter is a filter for recover.
-type recoveryFilter struct {
-}
+type recoveryFilter struct{}
// New create timeout filter.
func New() filter.Filter {
diff --git a/pkg/filter/remote/call.go b/pkg/filter/remote/call.go
index 12df54f..51981d3 100644
--- a/pkg/filter/remote/call.go
+++ b/pkg/filter/remote/call.go
@@ -118,7 +118,6 @@
}
resp, err := cli.Call(client.NewReq(c.Ctx, c.Request, *api))
-
if err != nil {
logger.Errorf("[dubbo-go-pixiu] client call err:%v!", err)
c.Err = err
diff --git a/pkg/filter/response/response.go b/pkg/filter/response/response.go
index 1e549bf..ff5b3b6 100644
--- a/pkg/filter/response/response.go
+++ b/pkg/filter/response/response.go
@@ -206,7 +206,6 @@
// traverse all the keys in the map and change the hump to underline
func humpToLine(in interface{}) interface{} {
-
var m map[string]interface{}
if v, ok := in.(map[string]interface{}); ok {
m = v
@@ -214,7 +213,7 @@
return in
}
- var out = make(map[string]interface{}, len(m))
+ out := make(map[string]interface{}, len(m))
for k1, v1 := range m {
x := humpToUnderline(k1)
@@ -224,7 +223,7 @@
out[x] = humpToLine(struct2Map(v1))
} else if reflect.TypeOf(v1).Kind() == reflect.Slice {
value := reflect.ValueOf(v1)
- var newTemps = make([]interface{}, 0, value.Len())
+ newTemps := make([]interface{}, 0, value.Len())
for i := 0; i < value.Len(); i++ {
newTemp := humpToLine(value.Index(i).Interface())
newTemps = append(newTemps, newTemp)
@@ -260,7 +259,7 @@
t := reflect.TypeOf(obj)
v := reflect.ValueOf(obj)
- var data = make(map[string]interface{})
+ data := make(map[string]interface{})
for i := 0; i < t.NumField(); i++ {
data[t.Field(i).Name] = v.Field(i).Interface()
}
diff --git a/pkg/filter/response/response_test.go b/pkg/filter/response/response_test.go
index 9c70934..e86561b 100644
--- a/pkg/filter/response/response_test.go
+++ b/pkg/filter/response/response_test.go
@@ -28,7 +28,7 @@
func TestNewDubboResponse(t *testing.T) {
resp := map[string]interface{}{
"age": 18,
- "iD": 0001,
+ "iD": 0o001,
"name": "tc",
"time": nil,
}
diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go
index b39188d..034dbb4 100644
--- a/pkg/logger/logger.go
+++ b/pkg/logger/logger.go
@@ -31,9 +31,7 @@
"go.uber.org/zap/zapcore"
)
-var (
- logger Logger
-)
+var logger Logger
// DubbogoPXLogger is logger struct
type DubbogoPXLogger struct {
@@ -116,7 +114,7 @@
zapLoggerConfig = *conf
}
zapLogger, _ := zapLoggerConfig.Build(zap.AddCallerSkip(1))
- //logger = zapLogger.Sugar()
+ // logger = zapLogger.Sugar()
logger = &DubbogoPXLogger{Logger: zapLogger.Sugar(), dynamicLevel: zapLoggerConfig.Level}
}
diff --git a/pkg/model/authority.go b/pkg/model/authority.go
index e4532b2..3fe805d 100644
--- a/pkg/model/authority.go
+++ b/pkg/model/authority.go
@@ -19,14 +19,14 @@
// AuthorityConfiguration blacklist/whitelist config
type AuthorityConfiguration struct {
- Rules []AuthorityRule `yaml:"authority_rules" json:"authority_rules"` //Rules the authority rule list
+ Rules []AuthorityRule `yaml:"authority_rules" json:"authority_rules"` // Rules the authority rule list
}
// AuthorityRule blacklist/whitelist rule
type AuthorityRule struct {
- Strategy StrategyType `yaml:"strategy" json:"strategy"` //Strategy the authority rule strategy
- Limit LimitType `yaml:"limit" json:"limit"` //Limit the authority rule limit
- Items []string `yaml:"items" json:"items"` //Items the authority rule items
+ Strategy StrategyType `yaml:"strategy" json:"strategy"` // Strategy the authority rule strategy
+ Limit LimitType `yaml:"limit" json:"limit"` // Limit the authority rule limit
+ Items []string `yaml:"items" json:"items"` // Items the authority rule items
}
// StrategyType the authority rule strategy enum
diff --git a/pkg/model/base.go b/pkg/model/base.go
index 79e2b84..6baad70 100644
--- a/pkg/model/base.go
+++ b/pkg/model/base.go
@@ -25,8 +25,7 @@
Info map[string]MetadataValue
}
-type MetadataValue interface {
-}
+type MetadataValue interface{}
// Status is the components status
diff --git a/pkg/model/bootstrap.go b/pkg/model/bootstrap.go
index d3a13b4..8fa4d48 100644
--- a/pkg/model/bootstrap.go
+++ b/pkg/model/bootstrap.go
@@ -63,8 +63,7 @@
}
// DynamicResources TODO
-type DynamicResources struct {
-}
+type DynamicResources struct{}
// ShutdownConfig how to shutdown pixiu.
type ShutdownConfig struct {
diff --git a/pkg/model/health.go b/pkg/model/health.go
index 0d87c0b..d2c18b3 100644
--- a/pkg/model/health.go
+++ b/pkg/model/health.go
@@ -18,8 +18,7 @@
package model
// HealthCheck
-type HealthCheck struct {
-}
+type HealthCheck struct{}
// HttpHealthCheck
type HttpHealthCheck struct {
diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go
index 60b578e..0f7f61c 100644
--- a/pkg/pool/pool.go
+++ b/pkg/pool/pool.go
@@ -32,7 +32,7 @@
"github.com/apache/dubbo-go-pixiu/pkg/client/http"
)
-//ClientPool a pool of client.
+// ClientPool a pool of client.
type ClientPool struct {
poolMap map[config.RequestType]*sync.Pool
}
diff --git a/pkg/registry/consul.go b/pkg/registry/consul.go
index 7e281b5..0d9dae5 100644
--- a/pkg/registry/consul.go
+++ b/pkg/registry/consul.go
@@ -71,7 +71,7 @@
}
func (crl *ConsulRegistryLoad) transfer2Url(service consul.AgentService) (*common.URL, error) {
- var params = url.Values{}
+ params := url.Values{}
var protocol string
for _, tag := range service.Tags {
@@ -87,7 +87,7 @@
}
methodsParam := strings.Split(params.Get(constant.METHODS_KEY), ",")
- var methods = make([]string, len(methodsParam))
+ methods := make([]string, len(methodsParam))
for _, method := range methodsParam {
if method != "" {
methods = append(methods, method)
diff --git a/pkg/remoting/etcd3/client_test.go b/pkg/remoting/etcd3/client_test.go
index 89300a1..2bf51bb 100644
--- a/pkg/remoting/etcd3/client_test.go
+++ b/pkg/remoting/etcd3/client_test.go
@@ -84,7 +84,6 @@
// start etcd server
func (suite *ClientTestSuite) SetupSuite() {
-
t := suite.T()
DefaultListenPeerURLs := "http://localhost:2382"
@@ -139,7 +138,6 @@
}
func (suite *ClientTestSuite) TestClientClose() {
-
c := suite.client
t := suite.T()
@@ -150,7 +148,6 @@
}
func (suite *ClientTestSuite) TestClientValid() {
-
c := suite.client
t := suite.T()
@@ -164,7 +161,6 @@
}
func (suite *ClientTestSuite) TestClientDone() {
-
c := suite.client
go func() {
@@ -180,7 +176,6 @@
}
func (suite *ClientTestSuite) TestClientCreateKV() {
-
tests := tests
c := suite.client
@@ -211,7 +206,6 @@
}
func (suite *ClientTestSuite) TestClientDeleteKV() {
-
tests := tests
c := suite.client
t := suite.T()
@@ -241,11 +235,9 @@
t.Fatal(err)
}
}
-
}
func (suite *ClientTestSuite) TestClientGetChildrenKVList() {
-
tests := tests
c := suite.client
@@ -279,11 +271,9 @@
}
t.Fatalf("expect keylist %v but got %v expect valueList %v but got %v ", expectKList, kList, expectVList, vList)
-
}
func (suite *ClientTestSuite) TestClientWatch() {
-
tests := tests
c := suite.client
@@ -293,7 +283,6 @@
wg.Add(1)
go func() {
-
defer wg.Done()
wc, err := c.watch(prefix)
@@ -306,7 +295,6 @@
var eCreate, eDelete mvccpb.Event
for e := range wc {
-
for _, event := range e.Events {
events = append(events, (mvccpb.Event)(*event))
if event.Type == mvccpb.PUT {
@@ -341,11 +329,9 @@
c.Close()
wg.Wait()
-
}
func (suite *ClientTestSuite) TestClientRegisterTemp() {
-
c := suite.client
observeC := suite.setUpClient()
t := suite.T()
@@ -367,7 +353,6 @@
var eCreate, eDelete mvccpb.Event
for e := range wc {
-
for _, event := range e.Events {
events = append(events, (mvccpb.Event)(*event))
if event.Type == mvccpb.DELETE {
diff --git a/pkg/router/route_test.go b/pkg/router/route_test.go
index 1f08bb9..6941e73 100644
--- a/pkg/router/route_test.go
+++ b/pkg/router/route_test.go
@@ -195,5 +195,4 @@
assert.Nil(t, e)
e = rt.PutAPI(router.API{URLPattern: "/vought/:id/supe/:name", Method: n1})
assert.Nil(t, e)
-
}
diff --git a/samples/admin/server/app/server.go b/samples/admin/server/app/server.go
index d721735..5409598 100644
--- a/samples/admin/server/app/server.go
+++ b/samples/admin/server/app/server.go
@@ -40,9 +40,7 @@
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3e9)
-)
+var survivalTimeout = int(3e9)
// they are necessary:
// export CONF_PROVIDER_FILE_PATH="xxx"
diff --git a/samples/admin/server/app/user.go b/samples/admin/server/app/user.go
index 8319840..fff0e26 100644
--- a/samples/admin/server/app/user.go
+++ b/samples/admin/server/app/user.go
@@ -128,8 +128,7 @@
// UserProvider the dubbo provider.
// like: version: 1.0.0 group: test
-type UserProvider struct {
-}
+type UserProvider struct{}
// CreateUser new user, PX config POST.
func (u *UserProvider) CreateUser(ctx context.Context, user *User) (*User, error) {
diff --git a/samples/admin/server/app/version.go b/samples/admin/server/app/version.go
index 2d2a70e..4a65956 100644
--- a/samples/admin/server/app/version.go
+++ b/samples/admin/server/app/version.go
@@ -17,7 +17,5 @@
package main
-var (
- // Version dubbo version
- Version = "2.7.5"
-)
+// Version dubbo version
+var Version = "2.7.5"
diff --git a/samples/dubbogo/http/server/app/server.go b/samples/dubbogo/http/server/app/server.go
index 6aee485..2dadd8b 100644
--- a/samples/dubbogo/http/server/app/server.go
+++ b/samples/dubbogo/http/server/app/server.go
@@ -39,9 +39,7 @@
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3e9)
-)
+var survivalTimeout = int(3e9)
// they are necessary:
// export CONF_PROVIDER_FILE_PATH="xxx"
diff --git a/samples/dubbogo/http/server/app/user.go b/samples/dubbogo/http/server/app/user.go
index 2faad0a..994ccfb 100644
--- a/samples/dubbogo/http/server/app/user.go
+++ b/samples/dubbogo/http/server/app/user.go
@@ -155,8 +155,7 @@
// UserProvider the dubbo provider.
// like: version: 1.0.0 group: test
-type UserProvider struct {
-}
+type UserProvider struct{}
// CreateUser new user, PX config POST.
func (u *UserProvider) CreateUser(ctx context.Context, user *User) (*User, error) {
diff --git a/samples/dubbogo/http/server/app/version.go b/samples/dubbogo/http/server/app/version.go
index 2d2a70e..4a65956 100644
--- a/samples/dubbogo/http/server/app/version.go
+++ b/samples/dubbogo/http/server/app/version.go
@@ -17,7 +17,5 @@
package main
-var (
- // Version dubbo version
- Version = "2.7.5"
-)
+// Version dubbo version
+var Version = "2.7.5"
diff --git a/samples/dubbogo/multi/server/app/server.go b/samples/dubbogo/multi/server/app/server.go
index fbb5edd..dd719a3 100644
--- a/samples/dubbogo/multi/server/app/server.go
+++ b/samples/dubbogo/multi/server/app/server.go
@@ -39,9 +39,7 @@
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3e9)
-)
+var survivalTimeout = int(3e9)
// they are necessary:
// export CONF_PROVIDER_FILE_PATH="xxx"
diff --git a/samples/dubbogo/multi/server/app/student.go b/samples/dubbogo/multi/server/app/student.go
index 2aa71ab..b9dd024 100644
--- a/samples/dubbogo/multi/server/app/student.go
+++ b/samples/dubbogo/multi/server/app/student.go
@@ -155,8 +155,7 @@
// StudentProvider the dubbo provider.
// like: version: 1.0.0 group: test
-type StudentProvider struct {
-}
+type StudentProvider struct{}
// CreateStudent new Student, PX config POST.
func (s *StudentProvider) CreateStudent(ctx context.Context, student *Student) (*Student, error) {
diff --git a/samples/dubbogo/multi/server/app/teacher.go b/samples/dubbogo/multi/server/app/teacher.go
index 80882e0..6c58fbb 100644
--- a/samples/dubbogo/multi/server/app/teacher.go
+++ b/samples/dubbogo/multi/server/app/teacher.go
@@ -154,8 +154,7 @@
// TeacherProvider the dubbo provider.
// like: version: 1.0.0 group: test
-type TeacherProvider struct {
-}
+type TeacherProvider struct{}
// CreateTeacher new teacher, PX config POST.
func (s *TeacherProvider) CreateTeacher(ctx context.Context, Teacher *Teacher) (*Teacher, error) {
diff --git a/samples/dubbogo/multi/server/app/version.go b/samples/dubbogo/multi/server/app/version.go
index 2d2a70e..4a65956 100644
--- a/samples/dubbogo/multi/server/app/version.go
+++ b/samples/dubbogo/multi/server/app/version.go
@@ -17,7 +17,5 @@
package main
-var (
- // Version dubbo version
- Version = "2.7.5"
-)
+// Version dubbo version
+var Version = "2.7.5"
diff --git a/samples/dubbogo/simple/server/app/server.go b/samples/dubbogo/simple/server/app/server.go
index fbb5edd..dd719a3 100644
--- a/samples/dubbogo/simple/server/app/server.go
+++ b/samples/dubbogo/simple/server/app/server.go
@@ -39,9 +39,7 @@
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3e9)
-)
+var survivalTimeout = int(3e9)
// they are necessary:
// export CONF_PROVIDER_FILE_PATH="xxx"
diff --git a/samples/dubbogo/simple/server/app/user.go b/samples/dubbogo/simple/server/app/user.go
index 6929207..e0f2b7d 100644
--- a/samples/dubbogo/simple/server/app/user.go
+++ b/samples/dubbogo/simple/server/app/user.go
@@ -155,8 +155,7 @@
// UserProvider the dubbo provider.
// like: version: 1.0.0 group: test
-type UserProvider struct {
-}
+type UserProvider struct{}
// CreateUser new user, PX config POST.
func (u *UserProvider) CreateUser(ctx context.Context, user *User) (*User, error) {
diff --git a/samples/dubbogo/simple/server/app/version.go b/samples/dubbogo/simple/server/app/version.go
index 2d2a70e..4a65956 100644
--- a/samples/dubbogo/simple/server/app/version.go
+++ b/samples/dubbogo/simple/server/app/version.go
@@ -17,7 +17,5 @@
package main
-var (
- // Version dubbo version
- Version = "2.7.5"
-)
+// Version dubbo version
+var Version = "2.7.5"
diff --git a/samples/http/server/app/server.go b/samples/http/server/app/server.go
index ee4a666..1597f80 100644
--- a/samples/http/server/app/server.go
+++ b/samples/http/server/app/server.go
@@ -74,7 +74,7 @@
q := r.URL.Query()
u, b = cache.Get(q.Get("name"))
}
- //w.WriteHeader(200)
+ // w.WriteHeader(200)
if b {
b, _ := json.Marshal(u)
w.Header().Set(constant.HeaderKeyContextType, constant.HeaderValueJsonUtf8)
diff --git a/samples/plugins/plugin/access.go b/samples/plugins/plugin/access.go
index b99d7b7..c579ce2 100644
--- a/samples/plugins/plugin/access.go
+++ b/samples/plugins/plugin/access.go
@@ -29,8 +29,7 @@
func main() {}
// Access filter
-type Access struct {
-}
+type Access struct{}
// ExternalPluginAccess export filter
func ExternalPluginAccess() filter.Filter {
diff --git a/samples/plugins/plugin/rate_limit.go b/samples/plugins/plugin/rate_limit.go
index e7c1ff0..49e55f3 100644
--- a/samples/plugins/plugin/rate_limit.go
+++ b/samples/plugins/plugin/rate_limit.go
@@ -27,8 +27,7 @@
)
// RateLimit filter
-type RateLimit struct {
-}
+type RateLimit struct{}
// ExternalPluginRateLimit export filter
func ExternalPluginRateLimit() filter.Filter {
diff --git a/samples/plugins/plugin/trace.go b/samples/plugins/plugin/trace.go
index c8b374f..055b6a5 100644
--- a/samples/plugins/plugin/trace.go
+++ b/samples/plugins/plugin/trace.go
@@ -23,8 +23,7 @@
)
// Trace filter
-type Trace struct {
-}
+type Trace struct{}
// ExternalPluginTrace export filter
func ExternalPluginTrace() filter.Filter {