Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
othomann committed Jan 21, 2020
1 parent f73554b commit d66bb0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/entrypoint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ func main() {
PostWriter: &realPostWriter{},
Results: strings.Split(*results, ","),
}
// strings.Split(..) with an empty string returns an array that contains one element, an empty string.
// The result folder should only be created if there are actual results to defined for the entrypoint.
if len(e.Results) >= 1 && e.Results[0] != "" {
if err := os.MkdirAll(pipeline.DefaultResultPath, 0755); err != nil {
log.Fatalf("Error creating the results directory: %v", err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/entrypoint/entrypointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func (e Entrypointer) Go() error {
// Write the post file *no matter what*
e.WritePostFile(e.PostFile, err)

// strings.Split(..) with an empty string returns an array that contains one element, an empty string.
// This creates an error when trying to open the result folder as a file.
if len(e.Results) >= 1 && e.Results[0] != "" {
if err := e.readResultsFromDisk(); err != nil {
logger.Fatalf("Error while handling results: %s", err)
Expand Down

0 comments on commit d66bb0d

Please sign in to comment.