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

Normalize paths on windows #411

Merged
merged 2 commits into from
Nov 12, 2020

Conversation

nlowe
Copy link
Contributor

@nlowe nlowe commented Oct 24, 2020

Fixes #409 by normalizing path separator direction before checking the exclude patterns.

I also found another failing test on windows related to path separators, let me know if you want me to break that out into its own PR. With these changes, all tanka tests are now passing on windows and in a go:1.15 linux docker container.

nlowe added 2 commits October 24, 2020 13:20
The glob package does not treat path separators as special, so patterns
like `**/vendor/**` literally match a path containing `/vendor/`. This
breaks down on windows. We can fix this by using filepath.ToSlash(...)
to normalize the slash direction when looking for files to format.
This fixes a failing test on windows due to path inconsistent path
separators. The test now passes on windows and linux.
Copy link
Member

@Duologic Duologic left a comment

Choose a reason for hiding this comment

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

LGTM

@sh0rez sh0rez merged commit 53b5a41 into grafana:master Nov 12, 2020
@nlowe nlowe deleted the bugfix/GH-409-normalize-paths-on-windows branch November 12, 2020 17:08
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.

tanka fmt tries to format files in vendor/ on windows
3 participants