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

hufeng pushed a commit to branch dubbo3
in repository https://gitbox.apache.org/repos/asf/dubbo-js.git


The following commit(s) were added to refs/heads/dubbo3 by this push:
     new a87285b  fix: when lint find errors, exit(1)
a87285b is described below

commit a87285b8cdc0705477938abd0b0dec95ad4e1392
Author: hufeng <[email protected]>
AuthorDate: Sun Oct 30 23:40:16 2022 +0800

    fix: when lint find errors, exit(1)
---
 lint/lint.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lint/lint.go b/lint/lint.go
index 1a77904..776a6dc 100644
--- a/lint/lint.go
+++ b/lint/lint.go
@@ -83,9 +83,10 @@ func fix_all(nl *NoticeLinter, ll *LicenseLinter) {
 //lint lint all file
 func lint(nl *NoticeLinter, ll *LicenseLinter) {
        now := time.Now()
+       var err error
 
        // lint mode
-       if err := nl.lint(); err != nil {
+       if err = nl.lint(); err != nil {
                fmt.Fprintln(os.Stderr, failed(err.Error()))
        }
 
@@ -100,4 +101,8 @@ func lint(nl *NoticeLinter, ll *LicenseLinter) {
        }
 
        fmt.Println(success(fmt.Sprintf("lint cost: %v", time.Since(now))))
+
+       if err != nil {
+               os.Exit(1)
+       }
 }

Reply via email to