Repository: kubernetes-sigs/krew
Pull request #629 (2020-08-04 17:43:03)

fix path warning on windows
Previously this was rendering as

    %!U(MISSING)SERPROFILE%!\(MISSING).krew\bin

while installing on windows. Using %% solves that.

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/krew/pull/629#" title="Author self-approved">ahmetb</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkrew).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/krew/blob/master/OWNERS)~~ [ahmetb]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
ahmetb: I also had to update the tests because the function actually has to return `%%USERPROFILE%%` but the test was looking for the full message that doesn't have `%%` notation.

The `%%` gets reduced to `%` at the caller site of this function that uses fmt.Sprintf/Printf.

/assign @corneliusweig 
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/krew/pull/629#" title="Author self-approved">ahmetb</a>*, *<a href="https://github.com/kubernetes-sigs/krew/pull/629#pullrequestreview-461247609" title="Approved">corneliusweig</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkrew).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/krew/blob/master/OWNERS)~~ [ahmetb,corneliusweig]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/cmd/krew/cmd/internal/setup_check.go b/cmd/krew/cmd/internal/setup_check.go
index 575ca19..990902c 100644
--- a/cmd/krew/cmd/internal/setup_check.go
+++ b/cmd/krew/cmd/internal/setup_check.go
@@ -28,7 +28,7 @@ import (
 
 const (
 	instructionWindows = `To be able to run kubectl plugins, you need to add the
-"%USERPROFILE%\.krew\bin" directory to your PATH environment variable
+"%%USERPROFILE%%\.krew\bin" directory to your PATH environment variable
 and restart your shell.`
 	instructionUnixTemplate = `To be able to run kubectl plugins, you need to add
 the following to your %s


Test patch:
diff --git a/cmd/krew/cmd/internal/setup_check_test.go b/cmd/krew/cmd/internal/setup_check_test.go
index f0001cb..71cd137 100644
--- a/cmd/krew/cmd/internal/setup_check_test.go
+++ b/cmd/krew/cmd/internal/setup_check_test.go
@@ -45,7 +45,7 @@ func TestIsBinDirInPATH_secondRun(t *testing.T) {
 }
 
 func TestSetupInstructions_windows(t *testing.T) {
-	const instructionsContain = "add the\n\"%USERPROFILE%\\.krew\\bin\" directory to your PATH environment variable"
+	const instructionsContain = `USERPROFILE`
 	os.Setenv("KREW_OS", "windows")
 	defer func() { os.Unsetenv("KREW_OS") }()
 	instructions := SetupInstructions()