mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
lint: upgrade golangci-lint
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
Ravi Chamarthy
parent
5f04092e71
commit
ac3801ea2d
+10
-4
@@ -8,10 +8,9 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
zotErrors "zotregistry.io/zot/errors"
|
||||
|
||||
"github.com/briandowns/spinner"
|
||||
"github.com/spf13/cobra"
|
||||
zotErrors "zotregistry.io/zot/errors"
|
||||
)
|
||||
|
||||
func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
@@ -21,7 +20,7 @@ func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
|
||||
var isSpinner, verifyTLS, fixedFlag, verbose bool
|
||||
|
||||
var cveCmd = &cobra.Command{
|
||||
cveCmd := &cobra.Command{
|
||||
Use: "cve [config-name]",
|
||||
Short: "Lookup CVEs in images hosted on zot",
|
||||
Long: `List CVEs (Common Vulnerabilities and Exposures) of images hosted on a zot instance`,
|
||||
@@ -37,11 +36,14 @@ func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
urlFromConfig, err := getConfigValue(configPath, args[0], "url")
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if urlFromConfig == "" {
|
||||
return zotErrors.ErrNoURLProvided
|
||||
}
|
||||
|
||||
servURL = urlFromConfig
|
||||
} else {
|
||||
return zotErrors.ErrNoURLProvided
|
||||
@@ -53,11 +55,14 @@ func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
isSpinner, err = parseBooleanConfig(configPath, args[0], showspinnerConfig)
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
verifyTLS, err = parseBooleanConfig(configPath, args[0], verifyTLSConfig)
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -84,6 +89,7 @@ func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -106,7 +112,7 @@ func NewCveCommand(searchService SearchService) *cobra.Command {
|
||||
|
||||
func setupCveFlags(cveCmd *cobra.Command, variables cveFlagVariables) {
|
||||
variables.searchCveParams["imageName"] = cveCmd.Flags().StringP("image", "I", "", "List CVEs by IMAGENAME[:TAG]")
|
||||
variables.searchCveParams["cveID"] = cveCmd.Flags().StringP("cve-id", "i", "", "List images affected by a CVE")
|
||||
variables.searchCveParams["cvid"] = cveCmd.Flags().StringP("cve-id", "i", "", "List images affected by a CVE")
|
||||
|
||||
cveCmd.Flags().StringVar(variables.servURL, "url", "", "Specify zot server URL if config-name is not mentioned")
|
||||
cveCmd.Flags().StringVarP(variables.user, "user", "u", "", `User Credentials of `+
|
||||
|
||||
Reference in New Issue
Block a user