refactor template parsing logic
Move the logic for selecting a license template based on user input into a standalone func (fetchTemplate), and add test cases for all code paths. Delay parsing predefined license templates. This allows the new fetchTemplate method to modify these templates before returning in the future (to add SPDX license information). Add tests to ensure that these templates must always parse properly. Rename copyrightData type to licenseData, since we will soon begin to add more than just copyright data here (SPDX ID). Rename prefix func to executeTemplate, since this better describes what the function is doing. These are all refactoring and cleanup changes; no behavioral changes.
This commit is contained in:
3
testdata/custom.tpl
vendored
Normal file
3
testdata/custom.tpl
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Copyright {{.Year}} {{.Holder}}
|
||||
|
||||
Custom License Template
|
||||
Reference in New Issue
Block a user