From 6742aa55df5750ee8ad4ec2c5ccf2bdc1570f9c2 Mon Sep 17 00:00:00 2001 From: skudasov Date: Wed, 18 Sep 2024 09:43:39 +0200 Subject: [PATCH] fix the script --- scripts/breaking-changes.sh | 5 ++++- tools/breakingchanges/breaking_changes.go | 10 +++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/breaking-changes.sh b/scripts/breaking-changes.sh index 1f63eb311..a1f43a6c7 100755 --- a/scripts/breaking-changes.sh +++ b/scripts/breaking-changes.sh @@ -1,2 +1,5 @@ #!/usr/bin/env bash -cd tools/breakingchanges/ && go run cmd/main.go -path ../.. || cd - \ No newline at end of file +cd tools/breakingchanges/ +go run cmd/main.go -path ../.. || exit_code=$? +cd - +exit ${exit_code:-0} \ No newline at end of file diff --git a/tools/breakingchanges/breaking_changes.go b/tools/breakingchanges/breaking_changes.go index 89fe5020b..36f803b1b 100644 --- a/tools/breakingchanges/breaking_changes.go +++ b/tools/breakingchanges/breaking_changes.go @@ -26,15 +26,10 @@ func DetectBreakingChanges(rootPath string) { eg := &errgroup.Group{} - // Function to process each directory - processDirectory := func(path string) error { - return runGorelease(path) - } - // Check root directory for go.mod if _, err := os.Stat(filepath.Join(rootPath, "go.mod")); err == nil { eg.Go(func() error { - return processDirectory(rootPath) + return runGorelease(rootPath) }) } @@ -53,7 +48,7 @@ func DetectBreakingChanges(rootPath string) { goModPath := filepath.Join(path, "go.mod") if _, err := os.Stat(goModPath); err == nil { eg.Go(func() error { - return processDirectory(path) + return runGorelease(path) }) } @@ -66,6 +61,7 @@ func DetectBreakingChanges(rootPath string) { // Wait for all goroutines to finish and collect errors if err := eg.Wait(); err != nil { + os.Exit(1) log.Fatalf("%sErrors occurred while running gorelease: %v%s\n", green, err, noColor) }