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 cli to work on windows #1139

Merged
merged 2 commits into from
Apr 4, 2022
Merged

Fix cli to work on windows #1139

merged 2 commits into from
Apr 4, 2022

Conversation

lkysow
Copy link
Member

@lkysow lkysow commented Apr 4, 2022

Previously would error about missing file consul\Chart.yaml. This
is because the go embedded filesystem must be accessed using /
delimiters but we were using filepath functions which on windows
use \.

How I've tested this PR:

  • tested on windows

How I expect reviewers to test this PR:

  • code

Checklist:

  • CHANGELOG entry added

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

@@ -86,11 +93,7 @@ func readFile(chart embed.FS, f string, pathPrefix string) (*loader.BufferedFile
if err != nil {
return nil, err
}
// Remove the path prefix.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rel() doesn't exist in the path package. I looked at copying it from filepath but it uses a lot of internal stuff to filepath so not an easy copy. I think we're okay just trimming the prefix here because we're always passing in pathPrefix (hence variable name), not something we need to properly calculate the relative directory of.

Copy link
Contributor

@t-eckert t-eckert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. Thank you for catching and fixing it.

@lkysow lkysow requested review from a team, jmurret and ishustava and removed request for a team April 4, 2022 19:25
Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

CHANGELOG.md Outdated Show resolved Hide resolved
Previously would error about missing file `consul\Chart.yaml`. This
is because the go embedded filesystem must be accessed using `/`
delimiters but we were using `filepath` functions which on windows
use `\`.
@lkysow lkysow merged commit 7341255 into main Apr 4, 2022
@lkysow lkysow deleted the lkysow/windows branch April 4, 2022 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants