Skip to content

Avoid treating \ as escape char on Windows#39

Open
radeksimko wants to merge 1 commit into
mattn:masterfrom
radeksimko:b-windows-backslash
Open

Avoid treating \ as escape char on Windows#39
radeksimko wants to merge 1 commit into
mattn:masterfrom
radeksimko:b-windows-backslash

Conversation

@radeksimko

Copy link
Copy Markdown
Contributor

Fixes #38

While this is probably not a perfect solution, I think it makes a good start as it makes all tests pass on Windows and fixes the most common issue when \ paths are used in the input.

I originally wanted to implement proper escaping for Windows too, but then I realized it would be a little more complex and I thought this is already a progress. 🤷‍♂️

@codecov-commenter

codecov-commenter commented May 30, 2020

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (28e4fdf) to head (74d265b).
⚠️ Report is 23 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          143       145    +2     
=========================================
+ Hits           143       145    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mattn

mattn commented Aug 28, 2020

Copy link
Copy Markdown
Owner

it is not good that isEscapeRune always return false.

@radeksimko

Copy link
Copy Markdown
Contributor Author

I agree @mattn - as I mentioned above this is rather simple solution which is just addressing the known \ case.

I can look into more complete solution, but I expect it to be much more complex than this, because escaping on Windows seems to be more context-dependent, so it's not as simple as declaring a single rune as escape character I'm afraid, unless I misread the available docs on this. Also escaping behaviours may differ between cmd.exe and PowerShell.

Either way if you are willing to review/discuss better Windows support I can look into it.

@caarlos0

Copy link
Copy Markdown

Hey, how can I help getting this merged in? We have a replace in our go.mod for almost a year now 😬

refs goreleaser/goreleaser#2080

@jamestiotio

Copy link
Copy Markdown

Hi @mattn @radeksimko, any plans on moving this PR forward? Seems like someone over at #38 have confirmed that this fix works. Would be great to have this feature in this package!

@caarlos0

caarlos0 commented Nov 21, 2022

Copy link
Copy Markdown

@jamestiotio I've been using a fork in @goreleaser for a while now: https://github.com/caarlos0/go-shellwords

It would be nicer if @mattn could merge this though

@caarlos0

Copy link
Copy Markdown

cc/ @mattn any chance we could get this merged?

@mattn

mattn commented Feb 26, 2025

Copy link
Copy Markdown
Owner

I cannot merge as this would break the existing behavior. At the very least this needs to be optional.

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.

bug: Parse function removes needed backslashes

5 participants