chore: fix lint

main
sudo pacman -Syu 2022-08-16 12:59:42 +07:00
parent 72f12c2533
commit ef6e0cd582
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 5 additions and 2 deletions

View File

@ -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