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

README: apply gofmt to examples #1687

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Dec 16, 2024

Summary

Format Go code snippets in the README with gofmt.

Changes

  • Replace spaces with tabs.
  • Add empty lines between imports.
  • Remove empty lines in blocks.
  • Add mdsf to check formatting in CI.

Motivation

The code should be formatted the same as gofmt even in the documentation.

@dolmen
Copy link
Collaborator

dolmen commented Jan 7, 2025

It would be helpful to have a CI test that ensures this remains in the future. Any pointer to such a tool that would extract blocks of go code from a Markdown document and report diffs?

@dolmen dolmen force-pushed the docs-format-go-examples branch from ed2aad8 to 3cf0926 Compare January 7, 2025 10:35
dolmen
dolmen previously approved these changes Jan 7, 2025
@dolmen dolmen changed the title docs: Format examples in README README: apply gofmt to examples Jan 7, 2025
@ccoVeille
Copy link
Contributor

I'm using mdsf for formatting fenced blocks in Markdown files.

https://github.com/hougesen/mdsf

@alexandear alexandear force-pushed the docs-format-go-examples branch 3 times, most recently from e078bb7 to 9937175 Compare January 20, 2025 17:48
@alexandear alexandear force-pushed the docs-format-go-examples branch from 9937175 to dfda68b Compare January 20, 2025 17:49
@alexandear alexandear requested a review from dolmen January 20, 2025 17:50
@alexandear
Copy link
Contributor Author

It would be helpful to have a CI test that ensures this remains in the future. Any pointer to such a tool that would extract blocks of go code from a Markdown document and report diffs?

Integrated hougesen/mdsf as @ccoVeille suggested.

@ccoVeille
Copy link
Contributor

CC: @hougesen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants