Add staticcheck fixes (#3221)

* Add staticcheck fixes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* update golangci-lint version

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2025-05-18 22:27:45 +05:30
committed by GitHub
parent 6cc6498844
commit 2b13af0a5e
58 changed files with 228 additions and 226 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ func (opts *DeleteSubCommand) run(input cli.Input) error {
}
if !opts.force && len(fnList) > 0 {
return errors.New("Package is used by at least one function, use -f to force delete")
return errors.New("package is used by at least one function, use -f to force delete")
}
err = deletePackage(input.Context(), opts.Client(), opts.name, opts.namespace)
if err != nil {
-2
View File
@@ -85,12 +85,10 @@ func (opts *GetSubCommand) run(input cli.Input) error {
if archive.Type == fv1.ArchiveTypeLiteral {
reader = bytes.NewReader(archive.Literal)
} else if archive.Type == fv1.ArchiveTypeUrl {
readCloser, err := pkgutil.DownloadStrorageURL(input.Context(), opts.Client(), archive.URL)
if err != nil {
return fmt.Errorf("error downloading from storage service url: %s: %w", archive.URL, err)
}
defer readCloser.Close()
reader = readCloser
}
+2 -2
View File
@@ -81,7 +81,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
}
if !strings.HasPrefix(absPath, rootDir) {
errs = multierror.Append(errs, fmt.Errorf("The files (%v) should be put under the same parent directory (%v) of spec directory; otherwise, the archive will be empty when applying spec files", path, rootDir))
errs = multierror.Append(errs, fmt.Errorf("the files (%v) should be put under the same parent directory (%v) of spec directory; otherwise, the archive will be empty when applying spec files", path, rootDir))
continue
}
@@ -93,7 +93,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
}
if len(files) == 0 {
errs = multierror.Append(errs, fmt.Errorf("Error finding any files with path \"%v\"", path))
errs = multierror.Append(errs, fmt.Errorf("error finding any files with path \"%v\"", path))
}
}
+2 -2
View File
@@ -61,7 +61,7 @@ func (opts *RebuildSubCommand) run(input cli.Input) error {
}
if pkg.Status.BuildStatus != fv1.BuildStatusFailed {
return fmt.Errorf("Package %v is not in %v state.",
return fmt.Errorf("package %v is not in %v state",
pkg.ObjectMeta.Name, fv1.BuildStatusFailed)
}
@@ -70,7 +70,7 @@ func (opts *RebuildSubCommand) run(input cli.Input) error {
return fmt.Errorf("update package status: %w", err)
}
fmt.Printf("Retrying build for pkg %v. Use \"fission pkg info --name %v\" to view status.\n", pkg.ObjectMeta.Name, pkg.ObjectMeta.Name)
fmt.Printf("Retrying build for pkg %v. Use \"fission pkg info --name %v\" to view status\n", pkg.ObjectMeta.Name, pkg.ObjectMeta.Name)
return nil
}