From 340402483ee4109a8c769e6c42fbbccfc18d4f33 Mon Sep 17 00:00:00 2001 From: lgtm <1gtm@users.noreply.github.com> Date: Tue, 1 Mar 2022 06:07:15 -0800 Subject: [PATCH] make fmt (#993) /cherry-pick Signed-off-by: 1gtm <1gtm@appscode.com> --- pkg/backup.go | 1 - pkg/root.go | 2 +- pkg/util.go | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/backup.go b/pkg/backup.go index 880d72e56..63e95e069 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -229,5 +229,4 @@ func (opt *postgresOptions) backupPostgreSQL(targetRef api_v1beta1.TargetRef) (* } return resticWrapper.RunBackup(opt.backupOptions, targetRef) - } diff --git a/pkg/root.go b/pkg/root.go index 2f5c45abe..e6baa396b 100644 --- a/pkg/root.go +++ b/pkg/root.go @@ -29,7 +29,7 @@ var SupportedProducts = []string{"stash-enterprise", "kubedb-ext-stash"} var licenseApiService string func NewRootCmd() *cobra.Command { - var rootCmd = &cobra.Command{ + rootCmd := &cobra.Command{ Use: "stash-postgres", Short: `PostgreSQL backup & restore plugin for Stash by AppsCode`, Long: `PostgreSQL backup & restore plugin for Stash by AppsCode. For more information, visit here: https://appscode.com/products/stash`, diff --git a/pkg/util.go b/pkg/util.go index ab41206e1..999bd0eae 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -117,7 +117,7 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin if !ok { return fmt.Errorf("can't find client cert") } - if err := ioutil.WriteFile(filepath.Join(opt.setupOptions.ScratchDir, core.TLSCertKey), certByte, 0600); err != nil { + if err := ioutil.WriteFile(filepath.Join(opt.setupOptions.ScratchDir, core.TLSCertKey), certByte, 0o600); err != nil { return err } @@ -127,12 +127,12 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin return fmt.Errorf("can't find client private key") } - if err := ioutil.WriteFile(filepath.Join(opt.setupOptions.ScratchDir, core.TLSPrivateKeyKey), keyByte, 0600); err != nil { + if err := ioutil.WriteFile(filepath.Join(opt.setupOptions.ScratchDir, core.TLSPrivateKeyKey), keyByte, 0o600); err != nil { return err } session.sh.SetEnv(EnvPGSSLKEY, filepath.Join(opt.setupOptions.ScratchDir, core.TLSPrivateKeyKey)) - //TODO: this one is hard coded here but need to change later + // TODO: this one is hard coded here but need to change later userName = opt.user } else { // set env for pg_dump/pg_dumpall @@ -181,7 +181,7 @@ func (session *sessionWrapper) setUserArgs(args string) { func (session *sessionWrapper) setTLSParameters(appBinding *appcatalog.AppBinding, scratchDir string) error { if appBinding.Spec.ClientConfig.CABundle != nil { - if err := ioutil.WriteFile(filepath.Join(scratchDir, core.ServiceAccountRootCAKey), appBinding.Spec.ClientConfig.CABundle, 0600); err != nil { + if err := ioutil.WriteFile(filepath.Join(scratchDir, core.ServiceAccountRootCAKey), appBinding.Spec.ClientConfig.CABundle, 0o600); err != nil { return err } session.sh.SetEnv(EnvPGSSLROOTCERT, filepath.Join(scratchDir, core.ServiceAccountRootCAKey))