aboutsummaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-08 04:29:18 +0700
committerShulhan <ms@kilabit.info>2026-01-08 04:29:18 +0700
commit2f6ebacaea7851be5c17a970514769dd3e9735e9 (patch)
treed34bcd794ae3946d1a5446e7554ec3cfeaa7c40b /config.go
parent161049a3996c574d521d6d3df55998028eb111c0 (diff)
downloadspdxconv-2f6ebacaea7851be5c17a970514769dd3e9735e9.tar.xz
all: implement conversion for SPDX-License-Identifier
If the file contains "SPDX-License-Identifier", it will not modify it. The program will move the identifier to the top of file after shebang. If the spdxconv.cfg contains match-license, and the pattern match with one of the line in the file, it will use the license_identifier instead of default one and insert it at the top, after shebang. If the files does not contains the identifier, it will insert new one based on default value in spdxconv.cfg file.
Diffstat (limited to 'config.go')
-rw-r--r--config.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/config.go b/config.go
index 962b0ad..1268cb8 100644
--- a/config.go
+++ b/config.go
@@ -9,7 +9,7 @@ type config struct {
LicenseIdentifier string `ini:"default::license_identifier"`
FileCopyrightText string `ini:"default::file_copyright_text"`
- MatchLicense []configMatchLicense `ini:"match-license"`
+ MatchLicense []*configMatchLicense `ini:"match-license"`
MaxLineMatch int `ini:"default::max_line_match"`
}
@@ -25,5 +25,11 @@ func (cfg *config) init() (err error) {
if cfg.MaxLineMatch <= 0 {
cfg.MaxLineMatch = defMaxLineMatch
}
+ for _, cml := range cfg.MatchLicense {
+ err = cml.init()
+ if err != nil {
+ return err
+ }
+ }
return nil
}