Address issues flagged by golangci-lint (#341)

This commit is contained in:
Vaibhav Kamra 2022-07-13 15:21:04 -07:00 committed by GitHub
parent 6f9fe0dd9e
commit c1c9cfe118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -43,13 +43,13 @@ var initCmd = &cobra.Command{
Use: initCommand, Use: initCommand,
Short: "Initialize a repository.", Short: "Initialize a repository.",
Long: `Create a new repository to store your backups.`, Long: `Create a new repository to store your backups.`,
Run: handleInitCmd, RunE: handleInitCmd,
Args: cobra.NoArgs, Args: cobra.NoArgs,
} }
// Handler for calls to `corso repo init`. // Handler for calls to `corso repo init`.
func handleInitCmd(cmd *cobra.Command, args []string) { func handleInitCmd(cmd *cobra.Command, args []string) error {
cmd.Help() return cmd.Help()
} }
// The repo connect subcommand. // The repo connect subcommand.
@ -59,11 +59,11 @@ var connectCmd = &cobra.Command{
Use: connectCommand, Use: connectCommand,
Short: "Connect to a repository.", Short: "Connect to a repository.",
Long: `Connect to an existing repository.`, Long: `Connect to an existing repository.`,
Run: handleConnectCmd, RunE: handleConnectCmd,
Args: cobra.NoArgs, Args: cobra.NoArgs,
} }
// Handler for calls to `corso repo connect`. // Handler for calls to `corso repo connect`.
func handleConnectCmd(cmd *cobra.Command, args []string) { func handleConnectCmd(cmd *cobra.Command, args []string) error {
cmd.Help() return cmd.Help()
} }

View File

@ -428,13 +428,11 @@ func walkDirectory(
return err return err
} }
switch e.(type) { switch e := e.(type) {
case fs.Directory: case fs.Directory:
d := e.(fs.Directory) dirs = append(dirs, e)
dirs = append(dirs, d)
case fs.File: case fs.File:
f := e.(fs.File) files = append(files, e)
files = append(files, f)
default: default:
errs = multierror.Append(errs, errors.Errorf("unexpected item type %T", e)) errs = multierror.Append(errs, errors.Errorf("unexpected item type %T", e))
logger.Ctx(ctx).Warnf("unexpected item of type %T; skipping", e) logger.Ctx(ctx).Warnf("unexpected item of type %T; skipping", e)