Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize imports, function comments, logic judgments, and return values #255

Merged
merged 4 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions apiserver/eurekaserver/access.go
Expand Up @@ -25,6 +25,7 @@ import (
"strings"

"github.com/emicklei/go-restful"

api "github.com/polarismesh/polaris-server/common/api/v1"
)

Expand Down
12 changes: 7 additions & 5 deletions apiserver/eurekaserver/server.go
Expand Up @@ -21,18 +21,20 @@ import (
"context"
"errors"
"fmt"
"net"
"net/http"
"strings"
"time"

"github.com/emicklei/go-restful"
"go.uber.org/zap"

"github.com/polarismesh/polaris-server/apiserver"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/plugin"
"github.com/polarismesh/polaris-server/service"
"github.com/polarismesh/polaris-server/service/healthcheck"
"go.uber.org/zap"
"net"
"net/http"
"strings"
"time"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions apiserver/eurekaserver/worker.go
Expand Up @@ -24,15 +24,16 @@ import (
"encoding/json"
"encoding/xml"
"fmt"
"github.com/polarismesh/polaris-server/common/model"
"github.com/polarismesh/polaris-server/service"
"github.com/polarismesh/polaris-server/service/healthcheck"
"sort"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"

"github.com/polarismesh/polaris-server/common/model"
"github.com/polarismesh/polaris-server/service"
"github.com/polarismesh/polaris-server/service/healthcheck"
)

//全量服务缓存
Expand Down
22 changes: 12 additions & 10 deletions apiserver/grpcserver/base.go
Expand Up @@ -20,20 +20,22 @@ package grpcserver
import (
"context"
"fmt"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/plugin"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
"io"
"net"
"net/http"
"strings"
"time"

"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/plugin"
)

// BaseGrpcServer base utilities and functions for gRPC Connector
Expand Down Expand Up @@ -445,4 +447,4 @@ func ConvertContext(ctx context.Context) context.Context {
ctx = context.WithValue(ctx, utils.StringContext("client-address"), address)
ctx = context.WithValue(ctx, utils.StringContext("user-agent"), userAgent)
return ctx
}
}
5 changes: 3 additions & 2 deletions apiserver/grpcserver/client_access.go
Expand Up @@ -23,12 +23,13 @@ import (
"io"
"strings"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/utils"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/utils"
)

/**
Expand Down
4 changes: 3 additions & 1 deletion apiserver/grpcserver/server.go
Expand Up @@ -20,11 +20,13 @@ package grpcserver
import (
"context"
"fmt"

"google.golang.org/grpc"

"github.com/polarismesh/polaris-server/apiserver"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/service"
"github.com/polarismesh/polaris-server/service/healthcheck"
"google.golang.org/grpc"
)

// GRPCServer GRPC API服务器
Expand Down
8 changes: 5 additions & 3 deletions apiserver/httpserver/config_client_access.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -18,11 +18,13 @@
package httpserver

import (
"strconv"

"github.com/emicklei/go-restful"
"github.com/google/uuid"
api "github.com/polarismesh/polaris-server/common/api/v1"
"go.uber.org/zap"
"strconv"

api "github.com/polarismesh/polaris-server/common/api/v1"
)

func (h *HTTPServer) getConfigFile(req *restful.Request, rsp *restful.Response) {
Expand Down
5 changes: 3 additions & 2 deletions apiserver/httpserver/config_connection_manager.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -19,9 +19,10 @@ package httpserver

import (
"context"
api "github.com/polarismesh/polaris-server/common/api/v1"
"sync"
"time"

api "github.com/polarismesh/polaris-server/common/api/v1"
)

const (
Expand Down
8 changes: 5 additions & 3 deletions apiserver/httpserver/config_console_access.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -18,11 +18,13 @@
package httpserver

import (
"strconv"

"go.uber.org/zap"

"github.com/emicklei/go-restful"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/utils"
"go.uber.org/zap"
"strconv"
)

// CreateConfigFileGroup 创建配置文件组
Expand Down
3 changes: 2 additions & 1 deletion apiserver/httpserver/config_server.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -19,6 +19,7 @@ package httpserver

import (
"fmt"

"github.com/emicklei/go-restful"
)

Expand Down
3 changes: 2 additions & 1 deletion apiserver/httpserver/core_console_access.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -19,6 +19,7 @@ package httpserver

import (
"fmt"

"github.com/emicklei/go-restful"
)

Expand Down
3 changes: 2 additions & 1 deletion apiserver/httpserver/handler.go
Expand Up @@ -27,9 +27,10 @@ import (
"github.com/emicklei/go-restful"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/utils"
"go.uber.org/zap"
)

// Handler HTTP请求/回复处理器
Expand Down
1 change: 1 addition & 0 deletions apiserver/httpserver/maintain_access.go
Expand Up @@ -25,6 +25,7 @@ import (
"time"

"github.com/emicklei/go-restful"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/utils"
Expand Down
3 changes: 2 additions & 1 deletion apiserver/httpserver/naming_console_access.go
Expand Up @@ -20,10 +20,11 @@ package httpserver
import (
"context"
"fmt"
proto "github.com/golang/protobuf/proto"
"net/http"

"github.com/emicklei/go-restful"
proto "github.com/golang/protobuf/proto"

api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/utils"
)
Expand Down
1 change: 1 addition & 0 deletions apiserver/httpserver/proto.go
Expand Up @@ -19,6 +19,7 @@ package httpserver

import (
"github.com/golang/protobuf/proto"

api "github.com/polarismesh/polaris-server/common/api/v1"
)

Expand Down
9 changes: 5 additions & 4 deletions apiserver/httpserver/server.go
Expand Up @@ -20,9 +20,6 @@ package httpserver
import (
"context"
"fmt"
"github.com/polarismesh/polaris-server/config"
"github.com/polarismesh/polaris-server/plugin/statis/local"
"github.com/polarismesh/polaris-server/service/healthcheck"
"net"
"net/http"
"net/http/pprof"
Expand All @@ -32,13 +29,17 @@ import (

"github.com/emicklei/go-restful"
"github.com/pkg/errors"
"go.uber.org/zap"

"github.com/polarismesh/polaris-server/apiserver"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/config"
"github.com/polarismesh/polaris-server/plugin"
"github.com/polarismesh/polaris-server/plugin/statis/local"
"github.com/polarismesh/polaris-server/service"
"go.uber.org/zap"
"github.com/polarismesh/polaris-server/service/healthcheck"
)

/**
Expand Down
3 changes: 2 additions & 1 deletion apiserver/l5pbserver/naming.go
Expand Up @@ -26,9 +26,10 @@ import (
"time"

"github.com/golang/protobuf/proto"
"go.uber.org/zap"

"github.com/polarismesh/polaris-server/common/api/l5"
"github.com/polarismesh/polaris-server/common/utils"
"go.uber.org/zap"
)

type l5Code uint32
Expand Down
3 changes: 2 additions & 1 deletion apiserver/l5pbserver/server.go
Expand Up @@ -23,11 +23,12 @@ import (
"net"
"time"

"go.uber.org/zap"

"github.com/polarismesh/polaris-server/apiserver"
"github.com/polarismesh/polaris-server/common/api/l5"
"github.com/polarismesh/polaris-server/plugin"
"github.com/polarismesh/polaris-server/service"
"go.uber.org/zap"
)

const (
Expand Down
20 changes: 9 additions & 11 deletions apiserver/xdsserverv3/server.go
Expand Up @@ -21,6 +21,10 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"strconv"
"strings"
"time"

cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
Expand All @@ -43,25 +47,19 @@ import (
serverv3 "github.com/envoyproxy/go-control-plane/pkg/server/v3"
testv3 "github.com/envoyproxy/go-control-plane/pkg/test/v3"
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
"github.com/golang/protobuf/ptypes"
_struct "github.com/golang/protobuf/ptypes/struct"
"github.com/golang/protobuf/ptypes/wrappers"
"go.uber.org/atomic"
"go.uber.org/zap"
"google.golang.org/grpc"

"github.com/polarismesh/polaris-server/apiserver"
"github.com/polarismesh/polaris-server/cache"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/connlimit"
"github.com/polarismesh/polaris-server/common/model"
"github.com/polarismesh/polaris-server/service"

"github.com/golang/protobuf/ptypes"

"net"
"strconv"
"strings"
"time"

"go.uber.org/atomic"
"go.uber.org/zap"
"google.golang.org/grpc"
)

const K8sDnsResolveSuffixSvc = ".svc"
Expand Down
7 changes: 4 additions & 3 deletions bootstrap/config/config.go
Expand Up @@ -20,17 +20,18 @@ package config
import (
"errors"
"fmt"
"github.com/polarismesh/polaris-server/service/healthcheck"
"github.com/polarismesh/polaris-server/config"
"os"

yaml "gopkg.in/yaml.v2"

"github.com/polarismesh/polaris-server/apiserver"
"github.com/polarismesh/polaris-server/cache"
"github.com/polarismesh/polaris-server/common/log"
"github.com/polarismesh/polaris-server/config"
"github.com/polarismesh/polaris-server/plugin"
"github.com/polarismesh/polaris-server/service"
"github.com/polarismesh/polaris-server/service/healthcheck"
"github.com/polarismesh/polaris-server/store"
yaml "gopkg.in/yaml.v2"
)

// Config 配置
Expand Down
12 changes: 7 additions & 5 deletions cache/config_file.go
@@ -1,4 +1,4 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Expand All @@ -19,13 +19,15 @@ package cache

import (
"context"
"github.com/polarismesh/polaris-server/common/log"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/store"
"go.uber.org/zap"
"math/rand"
"sync"
"time"

"go.uber.org/zap"

"github.com/polarismesh/polaris-server/common/log"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/polarismesh/polaris-server/store"
)

var (
Expand Down