This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git


The following commit(s) were added to refs/heads/main by this push:
     new 211d162  New Header Template: GPL-3.0-or-later (#128)
211d162 is described below

commit 211d1623e027fb5779254fbd93871c00ec069a2b
Author: Dillon Lees <[email protected]>
AuthorDate: Mon Aug 1 20:09:20 2022 -0400

    New Header Template: GPL-3.0-or-later (#128)
    
    * Create GPL-3.0-or-later.txt
    
    * allow header templates to reference template values more than once
---
 assets/header-templates/GPL-3.0-or-later.txt | 16 ++++++++++++++++
 pkg/header/config.go                         |  6 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/assets/header-templates/GPL-3.0-or-later.txt 
b/assets/header-templates/GPL-3.0-or-later.txt
new file mode 100644
index 0000000..3d893c7
--- /dev/null
+++ b/assets/header-templates/GPL-3.0-or-later.txt
@@ -0,0 +1,16 @@
+Copyright (C) [year] [owner]
+
+This file is part of [software-name].
+
+[software-name] is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+[software-name] is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
diff --git a/pkg/header/config.go b/pkg/header/config.go
index 39be42a..254eddb 100644
--- a/pkg/header/config.go
+++ b/pkg/header/config.go
@@ -196,9 +196,9 @@ func readLicenseFromSpdx(config *ConfigHeader) (string, 
error) {
                return "", fmt.Errorf("failed to find a license template for 
spdx id %v, %w", spdxID, err)
        }
        template := string(content)
-       template = strings.Replace(template, "[year]", 
strconv.Itoa(time.Now().Year()), 1)
-       template = strings.Replace(template, "[owner]", owner, 1)
-       template = strings.Replace(template, "[software-name]", name, 1)
+       template = strings.ReplaceAll(template, "[year]", 
strconv.Itoa(time.Now().Year()))
+       template = strings.ReplaceAll(template, "[owner]", owner)
+       template = strings.ReplaceAll(template, "[software-name]", name)
 
        return template, nil
 }

Reply via email to