You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/06/24 01:49:05 UTC

[incubator-shenyu-client-golang] branch main updated: polish build & fix golangci-lint (#12)

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

xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-client-golang.git


The following commit(s) were added to refs/heads/main by this push:
     new 371f198  polish build & fix golangci-lint (#12)
371f198 is described below

commit 371f198d85e71d6ff40d653ade91fac9d9f8fa16
Author: dengliming <li...@gmail.com>
AuthorDate: Fri Jun 24 09:49:00 2022 +0800

    polish build & fix golangci-lint (#12)
---
 .github/workflows/build.yml                 | 63 +++++++++++++----------------
 .github/workflows/license-checker.yml       | 32 +++++++++++++++
 .github/workflows/lint.yml                  | 40 ++++++++++++++++++
 .licenserc.yaml                             | 34 ++++++++++++++++
 README.md                                   | 24 ++++++-----
 README.md => README_CN.md                   | 24 ++++++-----
 clients/admin_client/shenyu_admin_client.go |  4 +-
 clients/client_factory.go                   | 10 ++---
 clients/http_client/http_client.go          |  6 +--
 common/http_client/common_http_handle.go    |  4 +-
 common/http_client/http_client_test.go      | 10 ++---
 common/http_client/put.go                   |  4 +-
 common/shenyu_error/shenyu_error.go         |  2 +-
 example/admin_client/main.go                |  4 +-
 example/http_client/main.go                 |  6 +--
 go.mod                                      |  2 +-
 model/admin_request.go                      |  2 +-
 17 files changed, 187 insertions(+), 84 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 899e024..eba64d2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,64 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 name: Build and Test
 on:
+  pull_request:
   push:
     branches:
-      - master
-  pull_request:
+      - main
 
 jobs:
-
-  lint:
-    name: Lint
+  build:
+    name: Build
     runs-on: ubuntu-latest
     steps:
       - name: Set up Go
         uses: actions/setup-go@v1
         with:
-          go-version: 1.12
+          go-version: 1.17
 
       - name: Check out code
         uses: actions/checkout@v1
 
-      - name: Lint Go Code
-        run: |
-          export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
-          go get -u golang.org/x/lint/golint
-          make lint
+      - name: Build
+        run: go build -v ./...
 
   test:
     name: Test
+    strategy:
+      matrix:
+        go-version: [ 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x ]
     runs-on: ubuntu-latest
     steps:
       - name: Set up Go
         uses: actions/setup-go@v1
         with:
-          go-version: 1.12
+          go-version: ${{ matrix.go-version }}
 
       - name: Check out code
         uses: actions/checkout@v1
 
       - name: Run Unit tests.
-        run: make test-coverage
-
-      - name: Upload Coverage report to CodeCov
-        uses: codecov/codecov-action@v1.0.0
-        with:
-          token: ${{secrets.CODECOV_TOKEN}}
-          file: ./coverage.txt
-
-  build:
-    name: Build
-    runs-on: ubuntu-latest
-    needs: [lint, test]
-    steps:
-      - name: Set up Go
-        uses: actions/setup-go@v1
-        with:
-          go-version: 1.12
-
-      - name: Check out code
-        uses: actions/checkout@v1
+        run: |
+          go test `go list ./... | grep -v examples` -coverprofile=coverage.txt -covermode=atomic
 
-      - name: Build
-        run: make build
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v3
diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml
new file mode 100644
index 0000000..ee5f902
--- /dev/null
+++ b/.github/workflows/license-checker.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+name: License checker
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+
+jobs:
+  check-license:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Check License Header
+        uses: apache/skywalking-eyes@v0.1.0
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..3650310
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: golangci-lint
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+
+jobs:
+  lint:
+    name: Lint
+    runs-on: ubuntu-latest
+    steps:
+      - name: Set up Go
+        uses: actions/setup-go@v1
+        with:
+          go-version: 1.12
+
+      - name: Check out code
+        uses: actions/checkout@v1
+
+      - name: golangci-lint
+        uses: golangci/golangci-lint-action@v3
+        with:
+          version: latest
+          args: --timeout 5m
diff --git a/.licenserc.yaml b/.licenserc.yaml
new file mode 100644
index 0000000..7bd826c
--- /dev/null
+++ b/.licenserc.yaml
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+header:
+  license:
+    spdx-id: Apache-2.0
+    copyright-owner: Apache Software Foundation
+
+  paths-ignore:
+    - 'licenses'
+    - '**/*.md'
+    - 'LICENSE'
+    - 'DISCLAIMER'
+    - 'NOTICE'
+    - '.gitignore'
+    - 'go.mod'
+    - 'go.sum'
+
+  comment: on-failure
\ No newline at end of file
diff --git a/README.md b/README.md
index c835acc..8fd5738 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,10 @@
-# shenyu-client-golang [中文](./README_CN.md) #
+# shenyu-client-golang
 
-![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)
+English | [简体中文](README_CN.md)
+
+[![build](https://github.com/apache/incubator-shenyu-client-golang/workflows/build/badge.svg?branch=main)](https://github.com/apache/incubator-shenyu-client-golang/actions)
+[![codecov.io](https://codecov.io/gh/apache/incubator-shenyu-client-golang/coverage.svg?branch=main)](https://app.codecov.io/gh/apache/incubator-shenyu-client-golang?branch=main)
+[![GoDoc](https://godoc.org/github.com/apache/incubator-shenyu-client-golang?status.svg)](https://godoc.org/github.com/apache/incubator-shenyu-client-golang)
 
 ---
 
@@ -29,16 +33,16 @@ $ go get -u github.com/apache/incubator-shenyu-client-golang
 ```go
 Or you will see this error :
 	
-2022-05-05 15:24:28 [WARN] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:53] MetaDataRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
+2022-05-05 15:24:28 [WARN] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:53] MetaDataRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
 
 caused by:
 Post "http://127.0.0.1:9095/shenyu-client/register-metadata": dial tcp 127.0.0.1:9095: connect: connection refused
-2022-05-05 15:24:28 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> false
-2022-05-05 15:24:28 [WARN] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:68] UrlRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
+2022-05-05 15:24:28 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> false
+2022-05-05 15:24:28 [WARN] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:68] UrlRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
 
 caused by:
 Post "http://127.0.0.1:9095/shenyu-client/register-uri": dial tcp 127.0.0.1:9095: connect: connection refused
-2022-05-05 15:24:28 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> false
+2022-05-05 15:24:28 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> false
 	
 ```
 
@@ -116,9 +120,9 @@ finish register metadata ,the result is-> true
 
 ## Entire Success log
 ```go
-2022-05-05 15:43:56 [INFO] [github.com/incubator-shenyu-client-golang/clients/admin_client/shenyu_admin_client.go:51] Get ShenYu Admin response, body is -> {200 login dashboard user success {1 admin 1 true 2018-06-23 15:12:22 2022-03-09 15:08:14 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE}}
-2022-05-05 15:43:56 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:40] this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE
-2022-05-05 15:43:57 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> true
-2022-05-05 15:43:57 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> true
+2022-05-05 15:43:56 [INFO] [github.com/apache/incubator-shenyu-client-golang/clients/admin_client/shenyu_admin_client.go:51] Get ShenYu Admin response, body is -> {200 login dashboard user success {1 admin 1 true 2018-06-23 15:12:22 2022-03-09 15:08:14 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE}}
+2022-05-05 15:43:56 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:40] this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE
+2022-05-05 15:43:57 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> true
+2022-05-05 15:43:57 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> true
 
 ```
diff --git a/README.md b/README_CN.md
similarity index 59%
copy from README.md
copy to README_CN.md
index c835acc..80d225b 100644
--- a/README.md
+++ b/README_CN.md
@@ -1,6 +1,10 @@
-# shenyu-client-golang [中文](./README_CN.md) #
+# shenyu-client-golang
 
-![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)
+[English](README.md) | 简体中文
+
+[![build](https://github.com/apache/incubator-shenyu-client-golang/workflows/build/badge.svg?branch=main)](https://github.com/apache/incubator-shenyu-client-golang/actions)
+[![codecov.io](https://codecov.io/gh/apache/incubator-shenyu-client-golang/coverage.svg?branch=main)](https://app.codecov.io/gh/apache/incubator-shenyu-client-golang?branch=main)
+[![GoDoc](https://godoc.org/github.com/apache/incubator-shenyu-client-golang?status.svg)](https://godoc.org/github.com/apache/incubator-shenyu-client-golang)
 
 ---
 
@@ -29,16 +33,16 @@ $ go get -u github.com/apache/incubator-shenyu-client-golang
 ```go
 Or you will see this error :
 	
-2022-05-05 15:24:28 [WARN] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:53] MetaDataRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
+2022-05-05 15:24:28 [WARN] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:53] MetaDataRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
 
 caused by:
 Post "http://127.0.0.1:9095/shenyu-client/register-metadata": dial tcp 127.0.0.1:9095: connect: connection refused
-2022-05-05 15:24:28 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> false
-2022-05-05 15:24:28 [WARN] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:68] UrlRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
+2022-05-05 15:24:28 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> false
+2022-05-05 15:24:28 [WARN] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:68] UrlRegister has error: The errCode is ->:503, The errMsg is  ->:Please check ShenYu admin service status
 
 caused by:
 Post "http://127.0.0.1:9095/shenyu-client/register-uri": dial tcp 127.0.0.1:9095: connect: connection refused
-2022-05-05 15:24:28 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> false
+2022-05-05 15:24:28 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> false
 	
 ```
 
@@ -116,9 +120,9 @@ finish register metadata ,the result is-> true
 
 ## Entire Success log
 ```go
-2022-05-05 15:43:56 [INFO] [github.com/incubator-shenyu-client-golang/clients/admin_client/shenyu_admin_client.go:51] Get ShenYu Admin response, body is -> {200 login dashboard user success {1 admin 1 true 2018-06-23 15:12:22 2022-03-09 15:08:14 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE}}
-2022-05-05 15:43:56 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:40] this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE
-2022-05-05 15:43:57 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> true
-2022-05-05 15:43:57 [INFO] [github.com/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> true
+2022-05-05 15:43:56 [INFO] [github.com/apache/incubator-shenyu-client-golang/clients/admin_client/shenyu_admin_client.go:51] Get ShenYu Admin response, body is -> {200 login dashboard user success {1 admin 1 true 2018-06-23 15:12:22 2022-03-09 15:08:14 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE}}
+2022-05-05 15:43:56 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:40] this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUxODIzMDM2fQ.gMzPKaNlXEd1Q517qQamOpg358W9L0-0cZN3lkk06WE
+2022-05-05 15:43:57 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> true
+2022-05-05 15:43:57 [INFO] [github.com/apache/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> true
 
 ```
diff --git a/clients/admin_client/shenyu_admin_client.go b/clients/admin_client/shenyu_admin_client.go
index df4904a..03c4b1c 100644
--- a/clients/admin_client/shenyu_admin_client.go
+++ b/clients/admin_client/shenyu_admin_client.go
@@ -19,8 +19,8 @@ package admin_client
 
 import (
 	"encoding/json"
-	"github.com/incubator-shenyu-client-golang/common/constants"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
+	"github.com/apache/incubator-shenyu-client-golang/model"
 	"github.com/wonderivan/logger"
 	"io/ioutil"
 	"net/http"
diff --git a/clients/client_factory.go b/clients/client_factory.go
index 1f20dba..59b6211 100644
--- a/clients/client_factory.go
+++ b/clients/client_factory.go
@@ -18,11 +18,11 @@
 package clients
 
 import (
-	"github.com/incubator-shenyu-client-golang/clients/admin_client"
-	"github.com/incubator-shenyu-client-golang/clients/http_client"
-	"github.com/incubator-shenyu-client-golang/common/constants"
-	"github.com/incubator-shenyu-client-golang/common/shenyu_error"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/clients/admin_client"
+	"github.com/apache/incubator-shenyu-client-golang/clients/http_client"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
+	"github.com/apache/incubator-shenyu-client-golang/common/shenyu_error"
+	"github.com/apache/incubator-shenyu-client-golang/model"
 	"reflect"
 )
 
diff --git a/clients/http_client/http_client.go b/clients/http_client/http_client.go
index 9873b2e..ad18038 100644
--- a/clients/http_client/http_client.go
+++ b/clients/http_client/http_client.go
@@ -18,9 +18,9 @@
 package http_client
 
 import (
-	"github.com/incubator-shenyu-client-golang/common/constants"
-	"github.com/incubator-shenyu-client-golang/common/shenyu_error"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
+	"github.com/apache/incubator-shenyu-client-golang/common/shenyu_error"
+	"github.com/apache/incubator-shenyu-client-golang/model"
 	"io/ioutil"
 	"net/http"
 	"strconv"
diff --git a/common/http_client/common_http_handle.go b/common/http_client/common_http_handle.go
index 9ef317d..e8570bd 100644
--- a/common/http_client/common_http_handle.go
+++ b/common/http_client/common_http_handle.go
@@ -33,9 +33,7 @@ func handleCommonUrl(url string, params map[string]string) string {
 	for key, value := range params {
 		url = url + key + "=" + value + "&"
 	}
-	if strings.HasSuffix(url, "&") {
-		url = url[:len(url)-1]
-	}
+	url = strings.TrimSuffix(url, "&")
 	return url
 }
 
diff --git a/common/http_client/http_client_test.go b/common/http_client/http_client_test.go
index e7f08e0..9403363 100644
--- a/common/http_client/http_client_test.go
+++ b/common/http_client/http_client_test.go
@@ -18,9 +18,7 @@
 package http_client
 
 import (
-	"encoding/json"
-	"github.com/incubator-shenyu-client-golang/common/constants"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
 	"github.com/wonderivan/logger"
 	"io/ioutil"
 	"net/http"
@@ -68,9 +66,9 @@ func TestHttpClientRequest(t *testing.T) {
 	if err != nil {
 		return
 	}
-	var adminToken = model.AdminToken{}
-	err = json.Unmarshal(bytes, &adminToken)
-	logger.Info("Get body is ->", adminToken)
+	/*var adminToken = model.AdminToken{}
+	err = json.Unmarshal(bytes, &adminToken)*/
+	logger.Info("Get body is ->", string(bytes))
 	if response.StatusCode == 200 {
 		return
 	} else {
diff --git a/common/http_client/put.go b/common/http_client/put.go
index 778a66a..664ead3 100644
--- a/common/http_client/put.go
+++ b/common/http_client/put.go
@@ -35,9 +35,7 @@ func put(url string, header http.Header, timeoutMs uint64, params map[string]str
 			body += key + "=" + value + "&"
 		}
 	}
-	if strings.HasSuffix(body, "&") {
-		body = body[:len(body)-1]
-	}
+	body = strings.TrimSuffix(body, "&")
 	request, errNew := http.NewRequest(http.MethodPut, url, strings.NewReader(body))
 	if errNew != nil {
 		err = errNew
diff --git a/common/shenyu_error/shenyu_error.go b/common/shenyu_error/shenyu_error.go
index 1c62a3b..34539e2 100644
--- a/common/shenyu_error/shenyu_error.go
+++ b/common/shenyu_error/shenyu_error.go
@@ -22,7 +22,7 @@ package shenyu_error
  **/
 import (
 	"fmt"
-	"github.com/incubator-shenyu-client-golang/common/constants"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
 )
 
 type ShenYuError struct {
diff --git a/example/admin_client/main.go b/example/admin_client/main.go
index ef87a90..1f1541e 100644
--- a/example/admin_client/main.go
+++ b/example/admin_client/main.go
@@ -18,8 +18,8 @@
 package main
 
 import (
-	"github.com/incubator-shenyu-client-golang/clients"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/clients"
+	"github.com/apache/incubator-shenyu-client-golang/model"
 	"github.com/wonderivan/logger"
 )
 
diff --git a/example/http_client/main.go b/example/http_client/main.go
index 4859908..6ad711d 100644
--- a/example/http_client/main.go
+++ b/example/http_client/main.go
@@ -18,9 +18,9 @@
 package main
 
 import (
-	"github.com/incubator-shenyu-client-golang/clients"
-	"github.com/incubator-shenyu-client-golang/common/constants"
-	"github.com/incubator-shenyu-client-golang/model"
+	"github.com/apache/incubator-shenyu-client-golang/clients"
+	"github.com/apache/incubator-shenyu-client-golang/common/constants"
+	"github.com/apache/incubator-shenyu-client-golang/model"
 	"github.com/wonderivan/logger"
 )
 
diff --git a/go.mod b/go.mod
index 7668e54..be0773c 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/incubator-shenyu-client-golang
+module github.com/apache/incubator-shenyu-client-golang
 
 go 1.17
 
diff --git a/model/admin_request.go b/model/admin_request.go
index f9d60e5..c80d85a 100644
--- a/model/admin_request.go
+++ b/model/admin_request.go
@@ -18,7 +18,7 @@
 package model
 
 import (
-	"github.com/incubator-shenyu-client-golang/common/http_client"
+	"github.com/apache/incubator-shenyu-client-golang/common/http_client"
 	"net/http"
 )