mirror of
https://github.com/chenasraf/sofmani.git
synced 2026-05-17 17:28:04 +00:00
refactor: fix lint errors/warnings
This commit is contained in:
@@ -153,15 +153,16 @@ func (c *AppConfig) GetConfigDesc() []string {
|
||||
}
|
||||
}
|
||||
|
||||
filter := "Filter: "
|
||||
var filterBuilder strings.Builder
|
||||
filterBuilder.WriteString("Filter: ")
|
||||
if len(c.Filter) > 0 {
|
||||
for _, f := range c.Filter {
|
||||
filter += fmt.Sprintf("\n %s", f)
|
||||
filterBuilder.WriteString(fmt.Sprintf("\n %s", f))
|
||||
}
|
||||
} else {
|
||||
filter += "None"
|
||||
filterBuilder.WriteString("None")
|
||||
}
|
||||
desc = append(desc, filter)
|
||||
desc = append(desc, filterBuilder.String())
|
||||
|
||||
return desc
|
||||
}
|
||||
|
||||
@@ -61,10 +61,8 @@ func (i *GitHubReleaseInstaller) Validate() []ValidationError {
|
||||
}
|
||||
if opts.DownloadFilename == nil || len(*opts.DownloadFilename.Resolve()) == 0 {
|
||||
errors = append(errors, ValidationError{FieldName: "download_filename", Message: validationIsRequired(), InstallerName: *info.Name})
|
||||
} else {
|
||||
if (*opts.DownloadFilename).Resolve() == nil || len(*(*opts.DownloadFilename).Resolve()) == 0 {
|
||||
errors = append(errors, ValidationError{FieldName: fmt.Sprintf("download_filename.%s", platform.GetPlatform()), Message: validationIsRequired(), InstallerName: *info.Name})
|
||||
}
|
||||
} else if (*opts.DownloadFilename).Resolve() == nil || len(*(*opts.DownloadFilename).Resolve()) == 0 {
|
||||
errors = append(errors, ValidationError{FieldName: fmt.Sprintf("download_filename.%s", platform.GetPlatform()), Message: validationIsRequired(), InstallerName: *info.Name})
|
||||
}
|
||||
if opts.Strategy != nil {
|
||||
if *opts.Strategy != GitHubReleaseInstallStrategyNone && *opts.Strategy != GitHubReleaseInstallStrategyTar && *opts.Strategy != GitHubReleaseInstallStrategyZip {
|
||||
|
||||
@@ -163,8 +163,8 @@ func ParselatformMap[T any](values map[string]T) *PlatformMap[T] {
|
||||
// NewPlatformMap creates a new PlatformMap from either a single value or a map.
|
||||
func NewPlatformMap[T any](input any) *PlatformMap[T] {
|
||||
switch v := input.(type) {
|
||||
case T:
|
||||
return ParsePlatformSingleValue(v)
|
||||
case nil:
|
||||
return nil
|
||||
case *T:
|
||||
if v != nil {
|
||||
return ParsePlatformSingleValue(*v)
|
||||
@@ -180,8 +180,8 @@ func NewPlatformMap[T any](input any) *PlatformMap[T] {
|
||||
}
|
||||
}
|
||||
return ParselatformMap(flat)
|
||||
case nil:
|
||||
return nil
|
||||
case T:
|
||||
return ParsePlatformSingleValue(v)
|
||||
default:
|
||||
panic(fmt.Sprintf("NewPlatformMap: unsupported input type %T", input))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -39,9 +40,7 @@ func CombineEnvMaps(envs ...*map[string]string) map[string]string {
|
||||
if env == nil {
|
||||
continue
|
||||
}
|
||||
for k, v := range *env {
|
||||
out[k] = v
|
||||
}
|
||||
maps.Copy(out, *env)
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -77,8 +76,6 @@ func mergeEnvs(source *[]string, target []string) []string {
|
||||
if source == nil {
|
||||
source = &[]string{} // Treat nil source as empty
|
||||
}
|
||||
for k, v := range EnvSliceAsMap(*source) {
|
||||
tgt[k] = v // Override or add keys from source
|
||||
}
|
||||
maps.Copy(tgt, EnvSliceAsMap(*source))
|
||||
return EnvMapAsSlice(tgt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user