From cf7671d2c4ac88cc81f36d3cb47217944db23c93 Mon Sep 17 00:00:00 2001 From: Michail Kargakis Date: Mon, 18 Apr 2016 11:49:43 +0200 Subject: [PATCH] kubectl: use platform-agnostic helper in edit https://github.com/kubernetes/kubernetes/issues/22371 still stands for Windows clients since path.Base is not platform-agnostic[1]. Use filepath.Base instead[2]. [1] https://golang.org/src/path/path.go?s=4482:4511#L166 [2] https://golang.org/src/path/filepath/path.go?s=12257:12286#L409 --- pkg/kubectl/cmd/edit.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kubectl/cmd/edit.go b/pkg/kubectl/cmd/edit.go index 02cc202ea94..78f613a8670 100644 --- a/pkg/kubectl/cmd/edit.go +++ b/pkg/kubectl/cmd/edit.go @@ -22,7 +22,7 @@ import ( "fmt" "io" "os" - "path" + "path/filepath" gruntime "runtime" "strings" @@ -227,7 +227,7 @@ outter: // launch the editor editedDiff := edited - edited, file, err = edit.LaunchTempFile(fmt.Sprintf("%s-edit-", path.Base(os.Args[0])), ext, buf) + edited, file, err = edit.LaunchTempFile(fmt.Sprintf("%s-edit-", filepath.Base(os.Args[0])), ext, buf) if err != nil { return preservedFile(err, results.file, errOut) } @@ -350,7 +350,7 @@ outter: // 3. invalid: retry those on the spot by looping ie. reloading the editor if results.retryable > 0 { fmt.Fprintln(errOut, errorMsg) - fmt.Fprintf(errOut, "You can run `%s replace -f %s` to try this update again.\n", path.Base(os.Args[0]), file) + fmt.Fprintf(errOut, "You can run `%s replace -f %s` to try this update again.\n", filepath.Base(os.Args[0]), file) continue outter } if results.notfound > 0 {