make validate: fix unused argument reports

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2023-06-16 16:25:11 +02:00
parent 337d3434ce
commit c3c4acc667
7 changed files with 17 additions and 16 deletions

View File

@ -737,7 +737,7 @@ func (i *Image) RepoDigests() ([]string, error) {
// Mount the image with the specified mount options and label, both of which // Mount the image with the specified mount options and label, both of which
// are directly passed down to the containers storage. Returns the fully // are directly passed down to the containers storage. Returns the fully
// evaluated path to the mount point. // evaluated path to the mount point.
func (i *Image) Mount(ctx context.Context, mountOptions []string, mountLabel string) (string, error) { func (i *Image) Mount(_ context.Context, mountOptions []string, mountLabel string) (string, error) {
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: time.Now(), Type: EventTypeImageMount}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: time.Now(), Type: EventTypeImageMount})
} }

View File

@ -15,7 +15,7 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
func (n *cniNetwork) NetworkUpdate(name string, options types.NetworkUpdateOptions) error { func (n *cniNetwork) NetworkUpdate(_ string, _ types.NetworkUpdateOptions) error {
return fmt.Errorf("NetworkUpdate is not supported for backend CNI: %w", types.ErrInvalidArg) return fmt.Errorf("NetworkUpdate is not supported for backend CNI: %w", types.ErrInvalidArg)
} }

View File

@ -52,6 +52,6 @@ func (c *linuxCpusetHandler) Destroy(ctr *CgroupControl) error {
} }
// Stat fills a metrics structure with usage stats for the controller // Stat fills a metrics structure with usage stats for the controller
func (c *linuxCpusetHandler) Stat(ctr *CgroupControl, m *cgroups.Stats) error { func (c *linuxCpusetHandler) Stat(_ *CgroupControl, _ *cgroups.Stats) error {
return nil return nil
} }

View File

@ -23,19 +23,19 @@ func CompleteCommandFlags(cmd *cobra.Command, flags FlagCompletions) {
/* Autocomplete Functions for cobra ValidArgsFunction */ /* Autocomplete Functions for cobra ValidArgsFunction */
// AutocompleteNone - Block the default shell completion (no paths) // AutocompleteNone - Block the default shell completion (no paths)
func AutocompleteNone(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteNone(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveNoFileComp return nil, cobra.ShellCompDirectiveNoFileComp
} }
// AutocompleteDefault - Use the default shell completion, // AutocompleteDefault - Use the default shell completion,
// allows path completion. // allows path completion.
func AutocompleteDefault(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteDefault(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveDefault return nil, cobra.ShellCompDirectiveDefault
} }
// AutocompleteCapabilities - Autocomplete linux capabilities options. // AutocompleteCapabilities - Autocomplete linux capabilities options.
// Used by --cap-add and --cap-drop. // Used by --cap-add and --cap-drop.
func AutocompleteCapabilities(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteCapabilities(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
caps := capabilities.AllCapabilities() caps := capabilities.AllCapabilities()
// convertCase will convert a string to lowercase only if the user input is lowercase // convertCase will convert a string to lowercase only if the user input is lowercase
@ -83,17 +83,17 @@ func autocompleteSubIDName(filename string) ([]string, cobra.ShellCompDirective)
} }
// AutocompleteSubgidName - Autocomplete subgidname based on the names in the /etc/subgid file. // AutocompleteSubgidName - Autocomplete subgidname based on the names in the /etc/subgid file.
func AutocompleteSubgidName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteSubgidName(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return autocompleteSubIDName("/etc/subgid") return autocompleteSubIDName("/etc/subgid")
} }
// AutocompleteSubuidName - Autocomplete subuidname based on the names in the /etc/subuid file. // AutocompleteSubuidName - Autocomplete subuidname based on the names in the /etc/subuid file.
func AutocompleteSubuidName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteSubuidName(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return autocompleteSubIDName("/etc/subuid") return autocompleteSubIDName("/etc/subuid")
} }
// AutocompleteArch - Autocomplete platform supported by container engines // AutocompleteArch - Autocomplete platform supported by container engines
func AutocompletePlatform(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompletePlatform(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
completions := []string{ completions := []string{
"linux/386", "linux/386",
"linux/amd64", "linux/amd64",
@ -115,7 +115,7 @@ func AutocompletePlatform(cmd *cobra.Command, args []string, toComplete string)
} }
// AutocompleteArch - Autocomplete architectures supported by container engines // AutocompleteArch - Autocomplete architectures supported by container engines
func AutocompleteArch(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteArch(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
completions := []string{ completions := []string{
"386", "386",
"amd64", "amd64",
@ -135,19 +135,19 @@ func AutocompleteArch(cmd *cobra.Command, args []string, toComplete string) ([]s
} }
// AutocompleteOS - Autocomplete OS supported by container engines // AutocompleteOS - Autocomplete OS supported by container engines
func AutocompleteOS(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteOS(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
completions := []string{"linux", "windows"} completions := []string{"linux", "windows"}
return completions, cobra.ShellCompDirectiveNoFileComp return completions, cobra.ShellCompDirectiveNoFileComp
} }
// AutocompleteJSONFormat - Autocomplete format flag option. // AutocompleteJSONFormat - Autocomplete format flag option.
// -> "json" // -> "json"
func AutocompleteJSONFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteJSONFormat(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return []string{"json"}, cobra.ShellCompDirectiveNoFileComp return []string{"json"}, cobra.ShellCompDirectiveNoFileComp
} }
// AutocompleteOneArg - Autocomplete one random arg // AutocompleteOneArg - Autocomplete one random arg
func AutocompleteOneArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func AutocompleteOneArg(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
if len(args) == 1 { if len(args) == 1 {
return nil, cobra.ShellCompDirectiveDefault return nil, cobra.ShellCompDirectiveDefault
} }

View File

@ -48,7 +48,7 @@ type namedHook struct {
// those specified in the OCI Runtime Specification and to control // those specified in the OCI Runtime Specification and to control
// OCI-defined stages instead of delegating to the OCI runtime. See // OCI-defined stages instead of delegating to the OCI runtime. See
// Hooks() for more information. // Hooks() for more information.
func New(ctx context.Context, directories []string, extensionStages []string) (manager *Manager, err error) { func New(_ context.Context, directories []string, extensionStages []string) (manager *Manager, err error) {
manager = &Manager{ manager = &Manager{
hooks: map[string]*current.Hook{}, hooks: map[string]*current.Hook{},
directories: directories, directories: directories,

View File

@ -73,7 +73,8 @@ func Create() List {
// AddInstance adds an entry for the specified manifest digest, with assorted // AddInstance adds an entry for the specified manifest digest, with assorted
// additional information specified in parameters, to the list or index. // additional information specified in parameters, to the list or index.
func (l *list) AddInstance(manifestDigest digest.Digest, manifestSize int64, manifestType, osName, architecture, osVersion string, osFeatures []string, variant string, features, annotations []string) error { func (l *list) AddInstance(manifestDigest digest.Digest, manifestSize int64, manifestType, osName, architecture, osVersion string, osFeatures []string, variant string, features, annotations []string) error { // nolint:revive
// FIXME: the annotations argument is currently ignored
if err := l.Remove(manifestDigest); err != nil && !errors.Is(err, os.ErrNotExist) { if err := l.Remove(manifestDigest); err != nil && !errors.Is(err, os.ErrNotExist) {
return err return err
} }

View File

@ -280,7 +280,7 @@ func (s *supplementedImageReference) NewImageSource(ctx context.Context, sys *ty
return iss, nil return iss, nil
} }
func (s *supplementedImageReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error { func (s *supplementedImageReference) DeleteImage(_ context.Context, _ *types.SystemContext) error {
return fmt.Errorf("deletion of images not implemented") return fmt.Errorf("deletion of images not implemented")
} }