Skip to content

Commit

Permalink
proceed even when go mod version doesn't give us anything
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Mar 19, 2022
1 parent 901ebfe commit c316977
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/sbom/sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package sbom
import (
"bufio"
"bytes"
"errors"
"fmt"
"strings"
)
Expand All @@ -31,7 +30,12 @@ func massageGoVersionM(b []byte) ([]byte, error) {
var out bytes.Buffer
scanner := bufio.NewScanner(bytes.NewReader(b))
if !scanner.Scan() {
return nil, errors.New("malformed input: no newlines")
// Input was malformed, and doesn't contain any newlines (it
// may even be empty). This seems to happen on Windows
// (https://github.com/google/ko/issues/535) and in unit tests.
// Just proceed with an empty output for now, and SBOMs will be empty.
// TODO: This should be an error.
return nil, nil
}
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("malformed input: %w", err)
Expand Down

0 comments on commit c316977

Please sign in to comment.