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 pattern comparison on windows #37

Merged
merged 1 commit into from
Feb 9, 2023

Conversation

jpogran
Copy link
Contributor

@jpogran jpogran commented Feb 7, 2023

This commit uses filepath.ToSlash to ensure all paths use forward seperators if on Windows.

🛠️ Description

The example header_ignore paths all use unix line endings which work fine so long as the paths compared are using unix path seperators. If this is run on Windows, filepath.Walk returns paths with Windows path seperators, which will appear different to doublestar.Match. It's safe to convert \ to / in place in this scenario, as these are valid paths.

🔗 External Links

👍 Definition of Done

  • New functionality works?
  • Tests added?

🤔 Can be merged upon approval?

This commit uses filepath.ToSlash to ensure all paths use forward seperators if on Windows.

The example `header_ignore` paths all use unix line endings which work fine so long as the paths compared are using unix path seperators. If this is run on Windows, filepath.Walk returns paths with Windows path seperators, which will appear different to doublestar.Match. It's safe to convert \ to / in place in this scenario, as these are valid paths.
@jpogran jpogran requested a review from a team February 7, 2023 18:00
Copy link
Contributor

@dlaguerta dlaguerta left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

Copy link
Member

@CalebAlbers CalebAlbers left a comment

Choose a reason for hiding this comment

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

Thanks a ton, @jpogran! I'll get this out in a release ASAP.

@CalebAlbers CalebAlbers merged commit 3d017c7 into hashicorp:main Feb 9, 2023
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