From 7cd00f3c21ca115423ac0e5d8842669c804622e4 Mon Sep 17 00:00:00 2001 From: DmitriyLewen Date: Wed, 8 Nov 2023 12:25:14 +0600 Subject: [PATCH] refactor(verification): don't create empty `ExcludedFiles` array Signed-off-by: DmitriyLewen --- utils/verification.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/verification.go b/utils/verification.go index b2d84cf..e6d38e4 100644 --- a/utils/verification.go +++ b/utils/verification.go @@ -44,9 +44,14 @@ func GetVerificationCode(files []*spdx.File, excludeFile string) (common.Package hsha1.Write([]byte(shasConcat)) bs := hsha1.Sum(nil) + var excludedFiles []string + if excludeFile != "" { + excludedFiles = []string{excludeFile} + } + code := common.PackageVerificationCode{ Value: fmt.Sprintf("%x", bs), - ExcludedFiles: []string{excludeFile}, + ExcludedFiles: excludedFiles, } return code, nil