Skip to content

Commit

Permalink
style:fix code style (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored May 30, 2023
1 parent efea579 commit 4cd06c9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
15 changes: 8 additions & 7 deletions examples/circuitbreak/consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ package main
import (
"context"
"fmt"
polaris "github.com/polarismesh/grpc-go-polaris"
"github.com/polarismesh/polaris-go/api"
"github.com/polarismesh/polaris-go/pkg/model"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
"log"
"net"
"net/http"
"strconv"
"strings"
"time"

"github.com/polarismesh/polaris-go/api"
"github.com/polarismesh/polaris-go/pkg/model"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

_ "github.com/polarismesh/grpc-go-polaris"
polaris "github.com/polarismesh/grpc-go-polaris"
"github.com/polarismesh/grpc-go-polaris/examples/common/pb"
)

Expand Down
6 changes: 3 additions & 3 deletions examples/routing/consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ package main
import (
"context"
"fmt"
polaris "github.com/polarismesh/grpc-go-polaris"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"log"
"net"
"net/http"
"strconv"
"strings"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"

_ "github.com/polarismesh/grpc-go-polaris"
polaris "github.com/polarismesh/grpc-go-polaris"
"github.com/polarismesh/grpc-go-polaris/examples/common/pb"
)

Expand Down
21 changes: 15 additions & 6 deletions import-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,25 @@ mkdir -p style_tool

cd style_tool

wget https://github.com/incu6us/goimports-reviser/releases/download/v3.3.0/goimports-reviser_3.3.0_darwin_arm64.tar.gz
tar -zxvf goimports-reviser_3.3.0_darwin_arm64.tar.gz
is_arm=$(/usr/bin/uname -m | grep "arm|aarch64" | wc -l)
goimports_target_file="goimports-reviser_3.3.1_linux_amd64.tar.gz"

if [ "$(uname)" == "Darwin" ]; then
if [ "${is_arm}" == "1" ]; then
goimports_target_file="goimports-reviser_3.3.1_darwin_arm64.tar.gz"
else
goimports_target_file="goimports-reviser_3.3.1_darwin_amd64.tar.gz"
fi
fi

wget "https://github.com/incu6us/goimports-reviser/releases/download/v3.3.1/${goimports_target_file}"
tar -zxvf ${goimports_target_file}
mv goimports-reviser ../

cd ../

find . -name "*.go" -type f | grep -v .pb.go|grep -v test/tools/tools.go | grep -v ./plugin.go | xargs -I {} ./goimports-reviser -rm-unused -format {} -project-name github.com/polarismesh/grpc-go-polaris

# 处理 go 代码格式化
go fmt ./...

# 检查 golangci-lint
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v
find . -name "*.go" -type f | grep -v .pb.go | grep -v test/tools/tools.go | grep -v ./plugin.go |
xargs -I {} ./goimports-reviser -rm-unused -format {} -local github.com/polarismesh/specification -project-name github.com/polarismesh/polaris
1 change: 1 addition & 0 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func getNamespace(options *dialOptions) string {
}

const keyDialOptions = "options"

const keyResponse = "response"

func (pr *polarisNamingResolver) lookup() (*resolver.State, api.ConsumerAPI, error) {
Expand Down

0 comments on commit 4cd06c9

Please sign in to comment.