Commit 2fcb8b84 by bergquist

style(cli): fixed typos

parent d7a72e30
...@@ -26,8 +26,8 @@ func validateInput(c CommandLine, pluginFolder string) error { ...@@ -26,8 +26,8 @@ func validateInput(c CommandLine, pluginFolder string) error {
return errors.New("missing path flag") return errors.New("missing path flag")
} }
fileinfo, err := os.Stat(pluginDir) fileInfo, err := os.Stat(pluginDir)
if err != nil && !fileinfo.IsDir() { if err != nil && !fileInfo.IsDir() {
return errors.New("path is not a directory") return errors.New("path is not a directory")
} }
...@@ -106,20 +106,20 @@ func SelectVersion(plugin m.Plugin, version string) (m.Version, error) { ...@@ -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") 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_.-]*/") r := regexp.MustCompile("^[a-zA-Z0-9_.-]*/")
return r.ReplaceAllString(filename, pluginname+"/") return r.ReplaceAllString(filename, pluginName+"/")
} }
var retryCount = 0 var retryCount = 0
func downloadFile(pluginName, filepath, url string) (err error) { func downloadFile(pluginName, filePath, url string) (err error) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
retryCount++ retryCount++
if retryCount == 1 { if retryCount == 1 {
log.Debug("\nFailed downloading. Will retry once.\n") log.Debug("\nFailed downloading. Will retry once.\n")
downloadFile(pluginName, filepath, url) downloadFile(pluginName, filePath, url)
} else { } else {
panic(r) panic(r)
} }
...@@ -142,12 +142,12 @@ func downloadFile(pluginName, filepath, url string) (err error) { ...@@ -142,12 +142,12 @@ func downloadFile(pluginName, filepath, url string) (err error) {
return err return err
} }
for _, zf := range r.File { 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() { if zf.FileInfo().IsDir() {
os.Mkdir(newfile, 0777) os.Mkdir(newFile, 0777)
} else { } else {
dst, err := os.Create(newfile) dst, err := os.Create(newFile)
if err != nil { if err != nil {
log.Errorf("%v", err) log.Errorf("%v", err)
} }
......
...@@ -19,7 +19,7 @@ func TestFoldernameReplacement(t *testing.T) { ...@@ -19,7 +19,7 @@ func TestFoldernameReplacement(t *testing.T) {
Convey("should be replaced with plugin name", func() { Convey("should be replaced with plugin name", func() {
for k, v := range paths { 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) { ...@@ -32,7 +32,7 @@ func TestFoldernameReplacement(t *testing.T) {
Convey("should be replaced with plugin name", func() { Convey("should be replaced with plugin name", func() {
for k, v := range paths { for k, v := range paths {
So(RemoveGitBuildFromname(pluginName, k), ShouldEqual, v) So(RemoveGitBuildFromName(pluginName, k), ShouldEqual, v)
} }
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment