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 support encoding.TextUnmarshaler #123

Merged
merged 6 commits into from
Jul 20, 2023

Conversation

mirecl
Copy link
Contributor

@mirecl mirecl commented Jul 7, 2023

Add support encoding.TextUnmarshaler for example:

type Config struct {
      LogLevel zapcore.Level `env:"LOG_LEVEL" env-default:"debug"`
}

Custom type zapcore.Level from zap implements interface encoding.TextUnmarshaler.

P.S. I am confident that this commit will be beneficial for the community.

@mirecl
Copy link
Contributor Author

mirecl commented Jul 7, 2023

@ilyakaznacheev, what do you think about it?

@ilyakaznacheev
Copy link
Owner

Thanks, I'll check

@clems71
Copy link

clems71 commented Jul 20, 2023

Seems definitely useful to me as well. For any type that inherently supports encoding.TextUnmarshaler , we'd better use that first. Plus it allows people to reuse types coming from an imported module as-is, without type def'ing a custom type for the sake of implementing SetValue .

@mirecl
Copy link
Contributor Author

mirecl commented Jul 20, 2023

@ilyakaznacheev, I am writing to inquire about the progress of the PR review. I understand that the review process can take time, but I wanted to check if there are any issues or problems that may be causing a delay.

@ilyakaznacheev ilyakaznacheev added the enhancement New feature or request label Jul 20, 2023
Copy link
Owner

@ilyakaznacheev ilyakaznacheev left a comment

Choose a reason for hiding this comment

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

Please add tests for this case.

README.md Outdated Show resolved Hide resolved
@mirecl
Copy link
Contributor Author

mirecl commented Jul 20, 2023

@ilyakaznacheev, done ✅

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #123 (a5a43ad) into master (aea2c89) will decrease coverage by 0.97%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
- Coverage   93.76%   92.79%   -0.97%     
==========================================
  Files           1        1              
  Lines         353      361       +8     
==========================================
+ Hits          331      335       +4     
- Misses         13       15       +2     
- Partials        9       11       +2     
Flag Coverage Δ
unittests 92.79% <76.92%> (-0.97%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cleanenv.go 92.79% <76.92%> (-0.97%) ⬇️

cleanenv.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cleanenv.go Outdated Show resolved Hide resolved
@ilyakaznacheev ilyakaznacheev merged commit c35e574 into ilyakaznacheev:master Jul 20, 2023
22 of 23 checks passed
@mirecl
Copy link
Contributor Author

mirecl commented Jul 20, 2023

@ilyakaznacheev, when can we expect a new release?

trunk-io bot referenced this pull request in ride-app/driver-service Oct 6, 2023
…#131)

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

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/ilyakaznacheev/cleanenv](https://togithub.com/ilyakaznacheev/cleanenv) | require | minor | `v1.4.2` -> `v1.5.0` |

---

### Release Notes

<details>
<summary>ilyakaznacheev/cleanenv (github.com/ilyakaznacheev/cleanenv)</summary>

### [`v1.5.0`](https://togithub.com/ilyakaznacheev/cleanenv/releases/tag/v1.5.0): Add TextUnmarshaler support, publish methods and bugfixes

[Compare Source](https://togithub.com/ilyakaznacheev/cleanenv/compare/v1.4.2...v1.5.0)

#### What's Changed

-   Add contributing guidelines by [@&#8203;ilyakaznacheev](https://togithub.com/ilyakaznacheev) in [https://github.com/ilyakaznacheev/cleanenv/pull/113](https://togithub.com/ilyakaznacheev/cleanenv/pull/113)
-   Add node on environment variable names by [@&#8203;ilyakaznacheev](https://togithub.com/ilyakaznacheev) in [https://github.com/ilyakaznacheev/cleanenv/pull/114](https://togithub.com/ilyakaznacheev/cleanenv/pull/114)
-   Published methods for get configuration through io.Reader by [@&#8203;padremortius](https://togithub.com/padremortius) in [https://github.com/ilyakaznacheev/cleanenv/pull/122](https://togithub.com/ilyakaznacheev/cleanenv/pull/122)
-   Add support `encoding.TextUnmarshaler` by [@&#8203;mirecl](https://togithub.com/mirecl) in [https://github.com/ilyakaznacheev/cleanenv/pull/123](https://togithub.com/ilyakaznacheev/cleanenv/pull/123)
-   Sort environment variables in usage output by [@&#8203;ilyakaznacheev](https://togithub.com/ilyakaznacheev) in [https://github.com/ilyakaznacheev/cleanenv/pull/124](https://togithub.com/ilyakaznacheev/cleanenv/pull/124)
-   Fix build card by [@&#8203;ilyakaznacheev](https://togithub.com/ilyakaznacheev) in [https://github.com/ilyakaznacheev/cleanenv/pull/125](https://togithub.com/ilyakaznacheev/cleanenv/pull/125)

#### New Contributors

-   [@&#8203;padremortius](https://togithub.com/padremortius) made their first contribution in [https://github.com/ilyakaznacheev/cleanenv/pull/122](https://togithub.com/ilyakaznacheev/cleanenv/pull/122)
-   [@&#8203;mirecl](https://togithub.com/mirecl) made their first contribution in [https://github.com/ilyakaznacheev/cleanenv/pull/123](https://togithub.com/ilyakaznacheev/cleanenv/pull/123)

**Full Changelog**: ilyakaznacheev/cleanenv@v1.4.2...v1.4.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), 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 has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ride-app/driver-service).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants