Repository navigation
feat: default to "," separator and RFC3339 time layout - #224
Merged
Merged
Conversation
obalunenko
force-pushed
the
feat/option-defaults
branch
from
November 15, 2026 18:38
bee4d9f to
6a50eb2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #224 +/- ##
==========================================
Coverage ? 100.00%
==========================================
Files ? 3
Lines ? 99
Branches ? 0
==========================================
Hits ? 99
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
obalunenko
force-pushed
the
feat/option-defaults
branch
2 times, most recently
from
November 15, 2026 18:52
59eedab to
8991d67
Compare
Without options the zero Parameters made every slice and time.Time lookup fail: an empty separator is rejected and time.Parse with an empty layout matches nothing. Default the separator to "," and the layout to time.RFC3339; the options still override them, and an explicitly empty separator is still an error. Behavior change: Env for a slice or time.Time without options used to return an error and now returns the parsed value. EnvOrDefault in the same case used to return the default and now returns the parsed value. Document that EnvOrDefault returns the default for invalid values too, not only for unset ones, and point to Env to tell them apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obalunenko
force-pushed
the
feat/option-defaults
branch
from
November 15, 2026 18:57
8991d67 to
33b6afb
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Stacked on #223: merge that first; GitHub will retarget this PR to
master.Without options, the zero
Parametersmade every slice andtime.Timelookup fail:Env[[]string]("K"),K=a,binvalid value(empty separator)Env[time.Time]("K"),K=2026-01-02T15:04:05Zparsing time ...: extra text(empty layout)Now the separator defaults to
","and the layout totime.RFC3339.option.WithSeparatorandoption.WithTimeLayoutstill override them, and an explicitly empty separator is still an error.The docs now say that
EnvOrDefaultreturns the default for invalid values too, not only for unset ones, and point toEnvto tell the two cases apart. The behavior ofEnvOrDefaultitself is unchanged. The same text is in the package doc, the option docs and the README.Testing
go test -race ./...passes, with new cases for the default separator, the default layout, an explicit empty separator, andEnvOrDefaultwith the default separator.Possible failures/side-effects
This is a behavior change for calls without options:
Envfor a slice ortime.Timeused to return an error and now returns the parsed value;EnvOrDefaultin the same case used to return the default and now returns the parsed value.Code that relied on getting the default here had its environment variable ignored, which is most likely a bug on its side, but it belongs in the release notes. Release it as a minor version.
🤖 Generated with Claude Code