-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Package FilesAnalyzed field does not behave according to spec #145
Comments
I am handling this |
Thanks @ianling. For what it's worth, the way I addressed this in the original tag-value code and SPDX model for the Golang tools was to add a second parameter, Lines 139 to 143 in a532726
Then, when parsing a document and encountering a new Package section, the default settings for that new Package are: tools-golang/tvloader/parser2v2/parse_package.go Lines 27 to 30 in a532726
which then gets overwritten only if a tools-golang/tvloader/parser2v2/parse_package.go Lines 95 to 101 in a532726
Happy to modify this if there's a more appropriate way to handle, especially given how the JSON / YAML tooling will have to handle this. |
Per the spec, if the FilesAnalyzed field is absent from a document, that should be interpreted as
FilesAnalyzed: true
.Unfortunately, for the JSON and YAML parsers/savers, this was missed, so if they are absent, they default to false.
Additionally, the zero/empty value of a boolean in Go is
false
, and the FilesAnalyzed field's JSON tag containsomitempty
, so we are unable to write out the FilesAnalyzed field to a file if it is false; it will simply be omitted, which results in other things (like the online SPDX validator tool) interpreting it astrue
.We should change this field to a pointer to denote that it can be absent, and also make sure that we handle that case properly by interpreting it as
true
across all the different file parsers.The text was updated successfully, but these errors were encountered: