Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ROOTDIR replacement separator on Windows #6

Merged
merged 1 commit into from Mar 10, 2020
Merged

Conversation

@gbrlsnchs
Copy link
Contributor

gbrlsnchs commented Mar 10, 2020

Prior to this change, on Windows, replacements would end up like:

$ROODIR/my\test\folders

This change fixes this by using the correct OS file separator.

Prior to this change, on Windows, replacements would end up like:

  $ROODIR/my\test\folders

This change fixes this by using the correct OS file separator.
@jba
jba approved these changes Mar 10, 2020
@jba jba merged commit 7baa066 into google:master Mar 10, 2020
2 checks passed
2 checks passed
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@@ -626,8 +626,9 @@ func expandVariables(s string, lookup func(string) (string, bool)) (string, erro
// scrub removes dynamic content from output.
func scrub(rootDir string, b []byte) []byte {
const scrubbedRootDir = "${ROOTDIR}"
rootDirWithSeparator := rootDir + string(filepath.Separator)
scrubbedRootDirWithSeparator := scrubbedRootDir + "/"
const sep = string(filepath.Separator)

This comment has been minimized.

Copy link
@vangent

vangent Mar 10, 2020

Collaborator

Can you use filepath.Join for these instead?

This comment has been minimized.

Copy link
@gbrlsnchs

gbrlsnchs Mar 10, 2020

Author Contributor

I guess that wouldn't work, filepath.Join strips slashes: https://play.golang.org/p/sEoyjK_i5aW.

@gbrlsnchs gbrlsnchs deleted the gbrlsnchs:fix-rootdir branch Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.