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

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7f852aa81 perf(ci): add `make check-fmt` command for ci enhanced code 
format validation (#3055)
7f852aa81 is described below

commit 7f852aa8164c35bf573b06862b0532f3dc73cf52
Author: ian <[email protected]>
AuthorDate: Mon Oct 20 20:10:19 2025 +0800

    perf(ci): add `make check-fmt` command for ci enhanced code format 
validation (#3055)
    
    * perf(ci): add make check-fmt command for enhanced code format validation
    - Implement clear error messaging when formatting issues are found
---
 .github/workflows/github-actions.yml |  2 +-
 Makefile                             | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index d0a9ee277..4757d75ef 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -62,7 +62,7 @@ jobs:
           ${{ runner.os }}-go-
 
     - name: Check Code Format
-      run: make fmt && git status && [[ -z `git status -s` ]]
+      run: make check-fmt
 
     - name: Unit Test
       run: make test
diff --git a/Makefile b/Makefile
index ad4e56969..0925d8c53 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ MAKEFLAGS += --no-print-directory
 CLI_DIR = tools/dubbogo-cli
 IMPORTS_FORMATTER_DIR = tools/imports-formatter
 
-.PHONY: help test fmt clean lint
+.PHONY: help test fmt clean lint check-fmt
 
 help:
        @echo "Available commands:"
@@ -46,6 +46,18 @@ fmt: install-imports-formatter
        go fmt ./... && GOROOT=$(shell go env GOROOT) imports-formatter
        cd $(CLI_DIR) && go fmt ./...
 
+# This command is used in CI to verify that code formatting is correct
+check-fmt:
+       @echo "Checking code format..."
+       @$(MAKE) fmt
+       @if ! git diff --exit-code --quiet; then \
+               echo "Error: The following files have formatting changes:"; \
+               git diff --name-only; \
+               echo ""; \
+               echo "Please run 'make fmt' to fix formatting issues and commit 
the changes."; \
+               exit 1; \
+       fi
+
 # Clean test generate files
 clean:
        rm -rf coverage.txt

Reply via email to