From ef6e0cd582bc738af2348527e77b5e845339f15f Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Tue, 16 Aug 2022 12:59:42 +0700 Subject: [PATCH] chore: fix lint --- license.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/license.go b/license.go index 6d88995..1b992c6 100644 --- a/license.go +++ b/license.go @@ -2,6 +2,7 @@ package main import ( "embed" + "errors" "fmt" "path/filepath" "strings" @@ -13,6 +14,8 @@ const ( templatesPath = "templates" ) +var ErrInvalidLicense = errors.New("invalid license") + //go:embed templates/* var embedFS embed.FS @@ -35,13 +38,13 @@ type templateInfo struct { func generateLicense(name string) (string, error) { if name == "" { - return "", fmt.Errorf("empty license name") + return "", fmt.Errorf("empty license name: %w", ErrInvalidLicense) } name = strings.ToUpper(name) templateInfo, ok := templates[name] if !ok { - return "", fmt.Errorf("not support license %s", name) + return "", fmt.Errorf("not support license %s: %w", name, ErrInvalidLicense) } // Get correct path of license