Skip to content
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

Bump github.com/spdx/tools-golang to v0.4.0 #1450

Merged
merged 3 commits into from
Jan 20, 2023

Conversation

lucacome
Copy link
Contributor

Adds support for SPDX 2.3

@kzantow
Copy link
Contributor

kzantow commented Jan 12, 2023

Hi @lucacome we already have SPDX 2.3 support -- we've been using the main branch of spdx/tools-golang for a while now, but it would definitely be good to update to the release tag!

@lucacome
Copy link
Contributor Author

any idea why the tests are failing with needs to be valid json ?

Signed-off-by: Luca Comellini <luca.com@gmail.com>
@kzantow
Copy link
Contributor

kzantow commented Jan 18, 2023

@lucacome there is some redaction of values when comparing JSON to snapshots, I think there were fields added which are making the redaction (which is just a few regular expressions) cause the JSON to be invalid. This should be a simple fix, I can help with if you need. It probably could be something like this:

func spdxJsonRedactor(s []byte) []byte {
	// each SBOM reports the time it was generated, which is not useful during snapshot testing
	s = regexp.MustCompile(`"created":\s+"[^"]*"`).ReplaceAll(s, []byte(`"created":""`))

	// each SBOM reports a unique documentNamespace when generated, this is not useful for snapshot testing
	s = regexp.MustCompile(`"documentNamespace":\s+"[^"]*"`).ReplaceAll(s, []byte(`"documentNamespace":""`))

	// the license list will be updated periodically, the value here should not be directly tested in snapshot tests
	return regexp.MustCompile(`"licenseListVersion":\s+"[^"]*"`).ReplaceAll(s, []byte(`"licenseListVersion":""`))
}

... and then the snapshots need to be updated by setting this flag to true (you can just temporarily update the code)

@kzantow kzantow merged commit e8be93a into anchore:main Jan 20, 2023
@kzantow
Copy link
Contributor

kzantow commented Jan 20, 2023

@lucacome I went ahead and fixed the tests, etc. -- thanks for the contribution!

@lucacome
Copy link
Contributor Author

Thanks for taking care of this, unfortunately I got busy with other stuff 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants