Release v0.3.0
Overview
Add public API function ValidateLicenses
which is used to determine if any of the provided licenses are invalid.
Required Action for Upgrading
There are no steps required to move to this release. This release adds an additional function to the public API. There are no changes to the existing API functions.
Details
ValidateLicenses
// ValidateLicenses checks if given licenses are valid according to spdx. Returns true if all the licenses are valid; otherwise, returns false and a slice of the invalid licenses.
ValidateLicenses(licenses []string) (bool, []string)
parameter: licenses
Licenses is a slice of strings which must be validated as SPDX expressions.
returns
Function ValidateLicenses
has 2 return values. First is bool
which equals true
if all of
the provided licenses provided are valid, and false
otherwise.
The second parameter is a slice of all invalid licenses which were provided.
Examples: ValidateLicenses returns no invalid licenses
valid, invalidLicenses := ValidateLicenses([]string{"Apache-2.0"})
assert.True(valid)
assert.Empty(invalidLicenses)
Examples: ValidateLicenses returns invalid licenses
valid, invalidLicenses := ValidateLicenses([]string{"NON-EXISTENT-LICENSE", "MIT"})
assert.False(valid)
assert.Contains(invalidLicenses, "NON-EXISTENT-LICENSE")
assert.NotContains(invalidLicenses, "MIT")
What's Changed
- Add a function to validate licenses #20 (@RomanIakovlev)
Full Changelog: v0.2.0...v0.3.0