Skip to content

Commit

Permalink
fix: exit with 1 when check failed
Browse files Browse the repository at this point in the history
  • Loading branch information
asjdf committed Jun 12, 2023
1 parent 058ee3f commit 4b27d8a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"github.com/spf13/cobra"
"os"
"registry-father/services"
"sort"
)
Expand All @@ -14,7 +15,7 @@ var checkCmd = &cobra.Command{
list, err := services.GetASInfoList()
if err != nil {
fmt.Println(err)
return
os.Exit(1)
}

// Check if latest AS info conflict with previous
Expand All @@ -27,6 +28,7 @@ var checkCmd = &cobra.Command{
for i := 1; i < len(list); i++ {
if services.CheckCIDRConflict(list[0], list[i]) {
fmt.Printf("AS%d conflict with AS%d\n", list[0].ASN, list[i].ASN)
os.Exit(1)
}
}
},
Expand Down

0 comments on commit 4b27d8a

Please sign in to comment.