Skip to content

Feat: Add gofmt formatting check support for Windows in CI - #254

Open
Thedarkmatter10 wants to merge 1 commit into
civo:masterfrom
Thedarkmatter10:feat/windows-formatting-check
Open

Feat: Add gofmt formatting check support for Windows in CI#254
Thedarkmatter10 wants to merge 1 commit into
civo:masterfrom
Thedarkmatter10:feat/windows-formatting-check

Conversation

@Thedarkmatter10

@Thedarkmatter10 Thedarkmatter10 commented May 7, 2025

Copy link
Copy Markdown
Contributor

@giornetta as per suggestion to create for windows support i have created a look pls.

What This PR Adds

This PR enhances the GitHub Actions CI pipeline by adding Windows support for gofmt formatting checks, ensuring consistency across platforms.

Summary of Changes

  • ➕ Added a Windows-specific step to perform gofmt -l check using PowerShell
  • 🔄 Preserved existing Linux formatting logic (no changes made to Ubuntu behavior)
  • 🧪 Verified the formatting check fails for unformatted code and passes after gofmt -w

🖥️ Test Output (Local Verification on Windows) with sample unformatted code.

scriptRunAfter

❌ Before Formatting

screnshotScriptRUNBefore

main.go
The following files need formatting:
main.go

@Thedarkmatter10

Copy link
Copy Markdown
Contributor Author

@giornetta The Windows run failed due to formatting issues caused by the addition of`gofmt -l . ; To fix this, I ran gofmt -w . ., which reformatted the files. As a result, version control now shows changes in many files. I'm unsure whether I should commit these changes or not.

Please help what i can do ?

@giornetta

Copy link
Copy Markdown
Member

@Thedarkmatter10 huh, looks like Windows line endings are not making gofmt happy. I'm not sure what we can do or if investigating this is even worth the effort to be honest. Windows can be such a pain to work with.

@Thedarkmatter10

Copy link
Copy Markdown
Contributor Author

@giornetta I think one possible solution will be the updated code i.e after formatting. First can merge after that this pr because issue is in formatting only right .

May be it is possible solution. Can we test ? And submit the second PR what's your thought ?

@giornetta

Copy link
Copy Markdown
Member

@Thedarkmatter10 I don't think that would be a viable solution, since Windows and Linux use different line endings for files and we definitely do not want all files to be converted to Windows-style line endings, imho.

@Thedarkmatter10

Copy link
Copy Markdown
Contributor Author

@giornetta then what's next ?
Just because I am curious to don't know why it is it platform dependent means linux and windows type ? Since I am using it on windows i didn't feel anything weird . Other than knowing the formatting issue .

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.

2 participants