Skip to content

Commit

Permalink
chore(staticcheck): code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Jun 30, 2022
1 parent 93b4160 commit 200a580
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ var rootCmd = &cobra.Command{
}

config.SonobuoyClient, err = client.NewSonobuoyClient(clientConfig, skc)
if err != nil {
return err
}

return nil
},
Expand Down
10 changes: 4 additions & 6 deletions pkg/retrieve/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func retrieveResults(config *pkg.Config, destinationDirectory string) error {
}

// Download results into target directory
err, results := writeResultsToDirectory(destinationDirectory, reader, ec)
results, err := writeResultsToDirectory(destinationDirectory, reader, ec)
if err != nil {
return errors.Wrap(err, "error retrieving certification results from sonobyuoy")
}
Expand All @@ -101,7 +101,7 @@ func retrieveResults(config *pkg.Config, destinationDirectory string) error {
return nil
}

func writeResultsToDirectory(outputDir string, r io.Reader, ec <-chan error) (error, []string) {
func writeResultsToDirectory(outputDir string, r io.Reader, ec <-chan error) ([]string, error) {
eg := &errgroup.Group{}
var results []string
eg.Go(func() error { return <-ec })
Expand All @@ -112,12 +112,10 @@ func writeResultsToDirectory(outputDir string, r io.Reader, ec <-chan error) (er
return err
}
// Only print the filename if not extracting. Allows capturing the filename for scripting.
for _, name := range filesCreated {
results = append(results, name)
}
results = append(results, filesCreated...)

return nil
})

return eg.Wait(), results
return results, eg.Wait()
}

0 comments on commit 200a580

Please sign in to comment.