Skip to content

Commit

Permalink
omg golang
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Sep 11, 2024
1 parent 90d2cf8 commit 15f6929
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/grabitsh/main_analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ func PerformAdvancedAnalysis(buffer *bytes.Buffer) {
result.FrameworkVersions = extractFrameworkVersions()
}()

// Fix for capturing two return values
go func() {
defer wg.Done()
result.CICDSystems = analyzeCICDWorkflows()
cicdSystems, err := analyzeCICDWorkflows() // Capture both values
if err != nil { // Handle the error
buffer.WriteString("Error analyzing CI/CD workflows: " + err.Error() + "\n")
return
}
result.CICDSystems = cicdSystems // Assign result if no error
}()

go func() {
Expand All @@ -62,6 +68,7 @@ func PerformAdvancedAnalysis(buffer *bytes.Buffer) {

wg.Wait()

// Marshal the result to JSON and write to buffer
jsonResult, _ := json.MarshalIndent(result, "", " ")
buffer.WriteString(string(jsonResult))
}

0 comments on commit 15f6929

Please sign in to comment.