You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ke...@apache.org on 2025/09/13 06:27:26 UTC
(skywalking-eyes) branch errhandler created (now 3764d60)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a change to branch errhandler
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
at 3764d60 fix: return error in license check, add MIT header
This branch includes the following new commits:
new 3764d60 fix: return error in license check, add MIT header
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(skywalking-eyes) 01/01: fix: return error in license check, add MIT header
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch errhandler
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
commit 3764d609a6722e5e924fa72bd6a4ae2cdfb906e7
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sat Sep 13 14:27:17 2025 +0800
fix: return error in license check, add MIT header
---
assets/header-templates/MIT.txt | 21 +++++++++++++++++++++
pkg/deps/check.go | 19 ++++++-------------
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/assets/header-templates/MIT.txt b/assets/header-templates/MIT.txt
new file mode 100644
index 0000000..ac1159c
--- /dev/null
+++ b/assets/header-templates/MIT.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) [year] [owner]
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/pkg/deps/check.go b/pkg/deps/check.go
index 04e8301..f21c13b 100644
--- a/pkg/deps/check.go
+++ b/pkg/deps/check.go
@@ -21,6 +21,7 @@ import (
"fmt"
"math"
"path/filepath"
+ "slices"
"strings"
"gopkg.in/yaml.v3"
@@ -69,20 +70,16 @@ func Check(mainLicenseSpdxID string, config *ConfigDeps, weakCompatible bool) er
report := Report{}
if err := Resolve(config, &report); err != nil {
- return nil
+ return err
}
return CheckWithMatrix(mainLicenseSpdxID, &matrix, &report, weakCompatible)
}
func compare(list []string, spdxID string) bool {
- for _, com := range list {
- if spdxID == com {
- return true
- }
- }
- return false
+ return slices.Contains(list, spdxID)
}
+
func compareAll(spdxIDs []string, compare func(spdxID string) bool) bool {
for _, spdxID := range spdxIDs {
if !compare(spdxID) {
@@ -91,13 +88,9 @@ func compareAll(spdxIDs []string, compare func(spdxID string) bool) bool {
}
return true
}
+
func compareAny(spdxIDs []string, compare func(spdxID string) bool) bool {
- for _, spdxID := range spdxIDs {
- if compare(spdxID) {
- return true
- }
- }
- return false
+ return slices.ContainsFunc(spdxIDs, compare)
}
func compareCompatible(matrix *CompatibilityMatrix, spdxID string, weakCompatible bool) bool {