Skip to content

Commit

Permalink
fix linter complaints surfaced by new linter versions
Browse files Browse the repository at this point in the history
Signed-off-by: Marvin Beckers <[email protected]>
  • Loading branch information
embik committed Apr 14, 2024
1 parent b86f5cb commit c0e8e88
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/krew/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var infoCmd = &cobra.Command{
Long: `Show detailed information about an available plugin.`,
Example: ` kubectl krew info PLUGIN
kubectl krew info INDEX/PLUGIN`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
index, plugin := pathutil.CanonicalPluginName(args[0])

p, err := indexscanner.LoadPluginByName(paths.IndexPluginsPath(index), plugin)
Expand Down
2 changes: 1 addition & 1 deletion cmd/krew/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Remarks:
the names of the plugins installed. This output can be piped back to the
"install" command.`,
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
receipts, err := installation.GetInstalledPluginReceipts(paths.InstallReceiptsPath())
if err != nil {
return errors.Wrap(err, "failed to find all installed versions")
Expand Down
2 changes: 1 addition & 1 deletion cmd/krew/cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Examples:
To fuzzy search plugins with a keyword:
kubectl krew search KEYWORD`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
indexes, err := indexoperations.ListIndexes(paths)
if err != nil {
return errors.Wrap(err, "failed to list indexes")
Expand Down
2 changes: 1 addition & 1 deletion cmd/krew/cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Example:
Remarks:
Failure to uninstall a plugin will result in an error and exit immediately.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
for _, name := range args {
if isCanonicalName(name) {
return errors.New("uninstall command does not support INDEX/PLUGIN syntax; just specify PLUGIN")
Expand Down
2 changes: 1 addition & 1 deletion cmd/krew/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This will reinstall all plugins that have a newer version in the local index.
Use "kubectl krew update" to renew the index.
To only upgrade single plugins provide them as arguments:
kubectl krew upgrade foo bar"`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
var ignoreUpgraded bool
var skipErrors bool

Expand Down
2 changes: 1 addition & 1 deletion cmd/krew/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Remarks:
- IndexPath is the directory that stores the local copy of the index git repository.
- InstallPath is the directory for plugin installations.
- BinPath is the directory for the symbolic links to the installed plugin executables.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
conf := [][]string{
{"GitTag", version.GitTag()},
{"GitCommit", version.GitCommit()},
Expand Down
2 changes: 1 addition & 1 deletion cmd/validate-krew-manifest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ var licenseFiles = map[string]struct{}{
func validateLicenseFileExists(krewRoot string) error {
dir := environment.NewPaths(krewRoot).InstallPath()
var files []string
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(dir, func(_ string, info os.FileInfo, err error) error {
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/download/downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func Test_extractTARGZ(t *testing.T) {
// "/" and appends "/" to directories.
func collectFiles(t *testing.T, scanPath string) []string {
var outFiles []string
if err := filepath.Walk(scanPath, func(fp string, info os.FileInfo, err error) error {
if err := filepath.Walk(scanPath, func(fp string, info os.FileInfo, _ error) error {
if fp == scanPath {
return nil
}
Expand Down Expand Up @@ -417,8 +417,8 @@ func Test_extractArchive(t *testing.T) {
defaultExtractors = oldextractors
}()
defaultExtractors = map[string]extractor{
"application/octet-stream": func(targetDir string, read io.ReaderAt, size int64) error { return nil },
"text/plain": func(targetDir string, read io.ReaderAt, size int64) error { return errors.New("fail test") },
"application/octet-stream": func(_ string, _ io.ReaderAt, _ int64) error { return nil },
"text/plain": func(_ string, _ io.ReaderAt, _ int64) error { return errors.New("fail test") },
}
type args struct {
filename string
Expand Down
2 changes: 1 addition & 1 deletion internal/installation/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func moveToInstallDir(srcDir, installDir string, fos []index.FileOperation) erro
if err != nil {
return errors.Wrap(err, "failed to find a temporary directory")
}
klog.V(4).Infof("Chmoding tmpdir to 0755", tmp)
klog.V(4).Infof("Chmoding tmpdir %q to 0755", tmp)
if err := os.Chmod(tmp, 0o755); err != nil {
// mktemp gives a 0700 directory but since we move this to KREW_ROOT, we need to make it 0755
return errors.Wrap(err, "failed to chmod temp directory")
Expand Down

0 comments on commit c0e8e88

Please sign in to comment.