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

feat(format): expose formatting utils in new formatcore package #43

Merged
merged 8 commits into from
Jun 16, 2021
Merged

feat(format): expose formatting utils in new formatcore package #43

merged 8 commits into from
Jun 16, 2021

Conversation

bastantoine
Copy link
Contributor

@bastantoine bastantoine commented Jun 7, 2021

This allows to use them when defining a custom formatter outside of the format package.

This should fix #38.

This allows to use them when defining a custom formatter outside of the `format` package.
format/base.go Outdated Show resolved Hide resolved
format/base.go Outdated Show resolved Hide resolved
format/base.go Outdated Show resolved Hide resolved
format/base.go Outdated Show resolved Hide resolved
@princjef
Copy link
Owner

As I look at this, I'm wondering if it makes more sense to put the base functions in a subpackage to separate it out from the individual formatters. I'm thinking something like format/formatcore/base.go, which means you'll invoke as formatcore.Bold, formatcore.Header, etc.

What do you think?

@princjef
Copy link
Owner

Looks like the linter failed. Can you take a look into the failures (mage lint) and also generate the markdown documentation once you're done (mage doc)

@bastantoine
Copy link
Contributor Author

As I look at this, I'm wondering if it makes more sense to put the base functions in a subpackage to separate it out from the individual formatters. I'm thinking something like format/formatcore/base.go, which means you'll invoke as formatcore.Bold, formatcore.Header, etc.

What do you think?

Yes I agree, now that those functions are available outside it seems legit they get their own package. I'll do the move.

formatcore/base.go Outdated Show resolved Hide resolved
princjef
princjef previously approved these changes Jun 16, 2021
Copy link
Owner

@princjef princjef left a comment

Choose a reason for hiding this comment

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

LGTM, just the one comment about moving the file. Thanks for taking the time to put this together!

Updated imports and added README.md in format/formatcore.
@princjef princjef changed the title Export formatting helpers from base.go feat(format): expose formatting utils in new formatcore package Jun 16, 2021
@princjef princjef merged commit e4b16b3 into princjef:master Jun 16, 2021
@bastantoine bastantoine deleted the export-format-helpers branch June 16, 2021 20:00
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.

[Feature request] Make helper functions of format/base.go public to be able to easily extend format.Format
2 participants