ilyakaznacheev / cleanenv

✨Clean and minimalistic environment configuration reader for Golang
MIT License
1.67k stars 116 forks source link

🫶 Add support `encoding.TextUnmarshaler` #123

Closed mirecl closed 1 year ago

mirecl commented 1 year ago

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 commented 1 year ago

@ilyakaznacheev, what do you think about it?

ilyakaznacheev commented 1 year ago

Thanks, I'll check

clems71 commented 1 year ago

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 commented 1 year ago

@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.

mirecl commented 1 year ago

@ilyakaznacheev, done ✅

codecov[bot] commented 1 year ago

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%) :arrow_down:

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%) :arrow_down:
mirecl commented 1 year ago

@ilyakaznacheev, when can we expect a new release?