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

Add Stringer support. Fix #29 #34

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Conversation

ghostiam
Copy link
Contributor

@ghostiam ghostiam commented Jun 26, 2024

Description

Unfortunately, PR #32 does not work as expected. For types that have a String() method, output is raw instead of using the method.

Example:

In this PR, formatting uses the String() method if it exists (for any type).

Also, for each field in the structure, the existence of this method is also checked, that is, if the parent structure does not have a String() method, but the fields do, then we will see normally formatted fields.

Since this behavior may not always be desirable, formatting is only enabled if the StringerFormatter option is true.

Fix #29

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

@ghostiam ghostiam changed the title Add Stringer support. Fix #29 Add Stringer support. Jun 26, 2024
@ghostiam ghostiam changed the title Add Stringer support. Add Stringer support. Fix #29 Jun 26, 2024
Copy link
Collaborator

@david-littlefarmer david-littlefarmer left a comment

Choose a reason for hiding this comment

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

Thanks for PR with fix!
Looks ok for me, merging.

@david-littlefarmer david-littlefarmer merged commit d10c886 into golang-cz:master Jun 26, 2024
1 check passed
renovate bot referenced this pull request in jippi/dottie Aug 19, 2024
….mod (#80)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/golang-cz/devslog](https://togithub.com/golang-cz/devslog)
| `v0.0.8` -> `v0.0.9` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolang-cz%2fdevslog/v0.0.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgolang-cz%2fdevslog/v0.0.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgolang-cz%2fdevslog/v0.0.8/v0.0.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolang-cz%2fdevslog/v0.0.8/v0.0.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>golang-cz/devslog (github.com/golang-cz/devslog)</summary>

###
[`v0.0.9`](https://togithub.com/golang-cz/devslog/releases/tag/v0.0.9)

[Compare
Source](https://togithub.com/golang-cz/devslog/compare/v0.0.8...v0.0.9)

#### What's Changed

- Fixed slog.Any does not handle interfaces by
[@&#8203;noppawitt](https://togithub.com/noppawitt) in
[https://github.com/golang-cz/devslog/pull/27](https://togithub.com/golang-cz/devslog/pull/27)
- string indent with new lines by
[@&#8203;david-littlefarmer](https://togithub.com/david-littlefarmer) in
[https://github.com/golang-cz/devslog/pull/24](https://togithub.com/golang-cz/devslog/pull/24)
- ignore unexported fields in struct to avoid panic by
[@&#8203;violin0622](https://togithub.com/violin0622) in
[https://github.com/golang-cz/devslog/pull/31](https://togithub.com/golang-cz/devslog/pull/31)
- color tests by
[@&#8203;david-littlefarmer](https://togithub.com/david-littlefarmer) in
[https://github.com/golang-cz/devslog/pull/33](https://togithub.com/golang-cz/devslog/pull/33)
- Stringer by
[@&#8203;david-littlefarmer](https://togithub.com/david-littlefarmer) in
[https://github.com/golang-cz/devslog/pull/32](https://togithub.com/golang-cz/devslog/pull/32)
- Add Stringer support. Fix
[#&#8203;29](https://togithub.com/golang-cz/devslog/issues/29) by
[@&#8203;ghostiam](https://togithub.com/ghostiam) in
[https://github.com/golang-cz/devslog/pull/34](https://togithub.com/golang-cz/devslog/pull/34)
- Removed equal signs from groups by
[@&#8203;david-littlefarmer](https://togithub.com/david-littlefarmer) in
[https://github.com/golang-cz/devslog/pull/36](https://togithub.com/golang-cz/devslog/pull/36)

#### New Contributors

- [@&#8203;noppawitt](https://togithub.com/noppawitt) made their first
contribution in
[https://github.com/golang-cz/devslog/pull/27](https://togithub.com/golang-cz/devslog/pull/27)
- [@&#8203;violin0622](https://togithub.com/violin0622) made their first
contribution in
[https://github.com/golang-cz/devslog/pull/31](https://togithub.com/golang-cz/devslog/pull/31)
- [@&#8203;ghostiam](https://togithub.com/ghostiam) made their first
contribution in
[https://github.com/golang-cz/devslog/pull/34](https://togithub.com/golang-cz/devslog/pull/34)

**Full Changelog**:
golang-cz/devslog@v0.0.8...v0.0.9

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* */1 * * *" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/jippi/dottie).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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] - Stringer types don't log the string representation
2 participants