Fix for issues caught by go-lint (#327)
Error list visible [here](https://github.com/alcionai/corso/actions/runs/2653381666)
This commit is contained in:
parent
80db9a56c7
commit
efe4319080
@ -36,7 +36,7 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command {
|
||||
case detailsCommand:
|
||||
c, fs = utils.AddCommand(parent, exchangeDetailsCmd)
|
||||
fs.StringVar(&backupDetailsID, "backup-details", "", "ID of the backup details to be shown.")
|
||||
c.MarkFlagRequired("backup-details")
|
||||
cobra.CheckErr(c.MarkFlagRequired("backup-details"))
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
@ -65,7 +65,9 @@ func Handle() {
|
||||
restore.AddCommands(corsoCmd)
|
||||
|
||||
ctx, log := logger.Seed(context.Background())
|
||||
defer log.Sync() // flush all logs in the buffer
|
||||
defer func() {
|
||||
_ = log.Sync() // flush all logs in the buffer
|
||||
}()
|
||||
|
||||
if err := corsoCmd.ExecuteContext(ctx); err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
@ -26,14 +26,14 @@ var repoCmd = &cobra.Command{
|
||||
Use: "repo",
|
||||
Short: "Manage your repositories",
|
||||
Long: `Initialize, configure, and connect to your account backup repositories.`,
|
||||
Run: handleRepoCmd,
|
||||
RunE: handleRepoCmd,
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
|
||||
// Handler for flat calls to `corso repo`.
|
||||
// Produces the same output as `corso repo --help`.
|
||||
func handleRepoCmd(cmd *cobra.Command, args []string) {
|
||||
cmd.Help()
|
||||
func handleRepoCmd(cmd *cobra.Command, args []string) error {
|
||||
return cmd.Help()
|
||||
}
|
||||
|
||||
// The repo init subcommand.
|
||||
|
||||
@ -38,7 +38,7 @@ func addS3Commands(parent *cobra.Command) *cobra.Command {
|
||||
}
|
||||
fs.StringVar(&accessKey, "access-key", "", "Access key ID (replaces the AWS_ACCESS_KEY_ID env variable).")
|
||||
fs.StringVar(&bucket, "bucket", "", "Name of the S3 bucket (required).")
|
||||
c.MarkFlagRequired("bucket")
|
||||
cobra.CheckErr(c.MarkFlagRequired("bucket"))
|
||||
fs.StringVar(&endpoint, "endpoint", "s3.amazonaws.com", "Server endpoint for S3 communication.")
|
||||
fs.StringVar(&prefix, "prefix", "", "Prefix applied to objects in the bucket.")
|
||||
return c
|
||||
|
||||
@ -34,7 +34,7 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command {
|
||||
fs.StringVar(&folder, "folder", "", "Name of the mail folder being restored")
|
||||
fs.StringVar(&mail, "mail", "", "ID of the mail message being restored")
|
||||
fs.StringVar(&backupID, "backup", "", "ID of the backup to restore")
|
||||
c.MarkFlagRequired("backup")
|
||||
cobra.CheckErr(c.MarkFlagRequired("backup"))
|
||||
fs.StringVar(&user, "user", "", "ID of the user whose exchange data will get restored")
|
||||
}
|
||||
return c
|
||||
|
||||
@ -25,12 +25,12 @@ var restoreCmd = &cobra.Command{
|
||||
Use: restoreCommand,
|
||||
Short: "Restore your service data",
|
||||
Long: `Restore the data stored in one of your M365 services.`,
|
||||
Run: handleRestoreCmd,
|
||||
RunE: handleRestoreCmd,
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
|
||||
// Handler for flat calls to `corso restore`.
|
||||
// Produces the same output as `corso restore --help`.
|
||||
func handleRestoreCmd(cmd *cobra.Command, args []string) {
|
||||
cmd.Help()
|
||||
func handleRestoreCmd(cmd *cobra.Command, args []string) error {
|
||||
return cmd.Help()
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ func CloseRepo(ctx context.Context, r *repository.Repository) {
|
||||
// (ex: corso backup restore exchange) is expected to no-op.
|
||||
func HasNoFlagsAndShownHelp(cmd *cobra.Command) bool {
|
||||
if cmd.Flags().NFlag() == 0 {
|
||||
cmd.Help()
|
||||
cobra.CheckErr(cmd.Help())
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@ -86,7 +86,7 @@ func (suite *WrapperIntegrationSuite) TestCloseAfterWrap() {
|
||||
k, err := openKopiaRepo(t, ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
k.wrap()
|
||||
require.NoError(t, k.wrap())
|
||||
|
||||
assert.Equal(t, 2, k.refCount)
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ func TestEnvvarsSuite(t *testing.T) {
|
||||
suite.Run(t, new(EnvvarsTestSuite))
|
||||
}
|
||||
|
||||
func (suite EnvvarsTestSuite) TestRunOnAny() {
|
||||
func (suite *EnvvarsTestSuite) TestRunOnAny() {
|
||||
env_variable := "TEST_ENVVARS_SUITE"
|
||||
os.Setenv(env_variable, "1")
|
||||
table := []struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user