Skip to content

Commit

Permalink
fix the script
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Sep 18, 2024
1 parent 2e986d0 commit 6742aa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 4 additions & 1 deletion scripts/breaking-changes.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#!/usr/bin/env bash
cd tools/breakingchanges/ && go run cmd/main.go -path ../.. || cd -
cd tools/breakingchanges/
go run cmd/main.go -path ../.. || exit_code=$?
cd -
exit ${exit_code:-0}
10 changes: 3 additions & 7 deletions tools/breakingchanges/breaking_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand All @@ -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)
})
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 6742aa5

Please sign in to comment.