From 2fcb8b849eaf8d21de19e76be6dd49f967642399 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 8 Mar 2016 14:30:25 +0100 Subject: [PATCH] style(cli): fixed typos --- .../grafana-cli/commands/install_command.go | 18 +++++++++--------- .../commands/install_command_test.go | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index 62ec403d706..2af6b71c878 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -26,8 +26,8 @@ func validateInput(c CommandLine, pluginFolder string) error { return errors.New("missing path flag") } - fileinfo, err := os.Stat(pluginDir) - if err != nil && !fileinfo.IsDir() { + fileInfo, err := os.Stat(pluginDir) + if err != nil && !fileInfo.IsDir() { return errors.New("path is not a directory") } @@ -106,20 +106,20 @@ func SelectVersion(plugin m.Plugin, version string) (m.Version, error) { return m.Version{}, errors.New("Could not find the version your looking for") } -func RemoveGitBuildFromname(pluginname, filename string) string { +func RemoveGitBuildFromName(pluginName, filename string) string { r := regexp.MustCompile("^[a-zA-Z0-9_.-]*/") - return r.ReplaceAllString(filename, pluginname+"/") + return r.ReplaceAllString(filename, pluginName+"/") } var retryCount = 0 -func downloadFile(pluginName, filepath, url string) (err error) { +func downloadFile(pluginName, filePath, url string) (err error) { defer func() { if r := recover(); r != nil { retryCount++ if retryCount == 1 { log.Debug("\nFailed downloading. Will retry once.\n") - downloadFile(pluginName, filepath, url) + downloadFile(pluginName, filePath, url) } else { panic(r) } @@ -142,12 +142,12 @@ func downloadFile(pluginName, filepath, url string) (err error) { return err } for _, zf := range r.File { - newfile := path.Join(filepath, RemoveGitBuildFromname(pluginName, zf.Name)) + newFile := path.Join(filePath, RemoveGitBuildFromName(pluginName, zf.Name)) if zf.FileInfo().IsDir() { - os.Mkdir(newfile, 0777) + os.Mkdir(newFile, 0777) } else { - dst, err := os.Create(newfile) + dst, err := os.Create(newFile) if err != nil { log.Errorf("%v", err) } diff --git a/pkg/cmd/grafana-cli/commands/install_command_test.go b/pkg/cmd/grafana-cli/commands/install_command_test.go index b88677cf614..52b329adf7f 100644 --- a/pkg/cmd/grafana-cli/commands/install_command_test.go +++ b/pkg/cmd/grafana-cli/commands/install_command_test.go @@ -19,7 +19,7 @@ func TestFoldernameReplacement(t *testing.T) { Convey("should be replaced with plugin name", func() { for k, v := range paths { - So(RemoveGitBuildFromname(pluginName, k), ShouldEqual, v) + So(RemoveGitBuildFromName(pluginName, k), ShouldEqual, v) } }) }) @@ -32,7 +32,7 @@ func TestFoldernameReplacement(t *testing.T) { Convey("should be replaced with plugin name", func() { for k, v := range paths { - So(RemoveGitBuildFromname(pluginName, k), ShouldEqual, v) + So(RemoveGitBuildFromName(pluginName, k), ShouldEqual, v) } }) })