From a2bbef6885137ca1192e69226463ebe231f7805e Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 16 Dec 2018 19:56:13 +0100 Subject: [PATCH] Rename internal variable --- cmd/cmd.go | 2 +- cmd/import.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index c6db523008a..4ac2ed9de56 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -32,7 +32,7 @@ type Config struct { add addCommandConfig dump dumpCommandConfig edit editCommandConfig - importC importCommandConfig + _import importCommandConfig keyring keyringCommandConfig } diff --git a/cmd/import.go b/cmd/import.go index 21def2ea38c..e028ee78a39 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -19,7 +19,7 @@ import ( vfs "github.com/twpayne/go-vfs" ) -var importCommand = &cobra.Command{ +var _importommand = &cobra.Command{ Use: "import", Args: cobra.MaximumNArgs(1), Short: "Import an archive", @@ -33,12 +33,12 @@ type importCommandConfig struct { } func init() { - rootCommand.AddCommand(importCommand) + rootCommand.AddCommand(_importommand) - persistentFlags := importCommand.PersistentFlags() - persistentFlags.StringVarP(&config.importC.destination, "destination", "d", "", "destination prefix") - persistentFlags.IntVar(&config.importC.stripComponents, "strip-components", 0, "strip components") - persistentFlags.BoolVarP(&config.importC.removeDestination, "remove-destination", "r", false, "remove destination before import") + persistentFlags := _importommand.PersistentFlags() + persistentFlags.StringVarP(&config._import.destination, "destination", "d", "", "destination prefix") + persistentFlags.IntVar(&config._import.stripComponents, "strip-components", 0, "strip components") + persistentFlags.BoolVarP(&config._import.removeDestination, "remove-destination", "r", false, "remove destination before import") } func (c *Config) runImportCommand(fs vfs.FS, cmd *cobra.Command, args []string) error { @@ -71,8 +71,8 @@ func (c *Config) runImportCommand(fs vfs.FS, cmd *cobra.Command, args []string) } } mutator := c.getDefaultMutator(fs) - if c.importC.removeDestination { - entry, err := ts.Get(c.importC.destination) + if c._import.removeDestination { + entry, err := ts.Get(c._import.destination) switch { case err == nil: if err := mutator.RemoveAll(filepath.Join(c.SourceDir, entry.SourceName())); err != nil { @@ -83,5 +83,5 @@ func (c *Config) runImportCommand(fs vfs.FS, cmd *cobra.Command, args []string) return err } } - return ts.Import(tar.NewReader(r), c.importC.destination, c.importC.stripComponents, mutator) + return ts.Import(tar.NewReader(r), c._import.destination, c._import.stripComponents, mutator) }