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

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 63254ac  ci: add ci check for gofmt (#1498)
63254ac is described below

commit 63254ac3be784f65ff2712d368b970125af6addf
Author: nic-chen <33000667+nic-c...@users.noreply.github.com>
AuthorDate: Tue Mar 2 01:04:36 2021 +0800

    ci: add ci check for gofmt (#1498)
---
 .github/workflows/go-lint.yml                         | 19 ++++++++++++++++++-
 api/internal/handler/data_loader/route_import.go      |  2 --
 api/internal/handler/service/service.go               |  1 -
 api/test/e2e/service_test.go                          |  1 -
 .../route_online_debug_suite_test.go                  |  1 -
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml
index c579dd2..74d775e 100644
--- a/.github/workflows/go-lint.yml
+++ b/.github/workflows/go-lint.yml
@@ -10,9 +10,26 @@ on:
 jobs:
   golangci:
     runs-on: ubuntu-latest
-
     steps:
       - uses: actions/checkout@v2
 
       - name: run lint
         run: make go-lint
+
+  gofmt:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: setup go
+        uses: actions/setup-go@v1
+        with:
+          go-version: '1.13'
+      - name: check gofmt
+        working-directory: ./api
+        run: |
+          diffs=`gofmt -l .`
+          if [[ -n $diffs ]]; then
+              echo "Files are not formatted by gofmt:"
+              echo $diffs
+              exit 1
+          fi
diff --git a/api/internal/handler/data_loader/route_import.go 
b/api/internal/handler/data_loader/route_import.go
index d1ed425..b070d96 100644
--- a/api/internal/handler/data_loader/route_import.go
+++ b/api/internal/handler/data_loader/route_import.go
@@ -58,11 +58,9 @@ func NewImportHandler() (handler.RouteRegister, error) {
        }, nil
 }
 
-
 var regPathVar = regexp.MustCompile(`{[\w.]*}`)
 var regPathRepeat = regexp.MustCompile(`-APISIX-REPEAT-URI-[\d]*`)
 
-
 func (h *ImportHandler) ApplyRoute(r *gin.Engine) {
        r.POST("/apisix/admin/import/routes", wgin.Wraps(h.Import,
                wrapper.InputType(reflect.TypeOf(ImportInput{}))))
diff --git a/api/internal/handler/service/service.go 
b/api/internal/handler/service/service.go
index 15c4a76..174e9ba 100644
--- a/api/internal/handler/service/service.go
+++ b/api/internal/handler/service/service.go
@@ -261,4 +261,3 @@ func (h *Handler) Patch(c droplet.Context) (interface{}, 
error) {
 
        return ret, nil
 }
-
diff --git a/api/test/e2e/service_test.go b/api/test/e2e/service_test.go
index 36885ab..9e03fca 100644
--- a/api/test/e2e/service_test.go
+++ b/api/test/e2e/service_test.go
@@ -355,4 +355,3 @@ func TestService_Update_Use_Patch_Method(t *testing.T) {
                testCaseCheck(tc, t)
        }
 }
-
diff --git 
a/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go 
b/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go
index d92a29e..e040c5b 100644
--- a/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go
+++ b/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go
@@ -34,4 +34,3 @@ var _ = ginkgo.AfterSuite(func() {
        base.CleanResource("consumers")
        time.Sleep(base.SleepTime)
 })
-

Reply via email to