fix(timeutil): remove unreachable panic() call #14427
Open
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.
Stumbled upon this while looking for
This has been added in snapd back in the day here:
Move conditionals to the correct case where they belong (e.g. >= -cutoffDays belongs to the "%d days ago", ...), and then just naturally move the non-special case of then.Format("2006-01-02") to the default case.
Looking at compiler explorer, it seems like Go (gc 1.21 on x86_64) can optimize out the old version's panic(), so it's just dead code in the source (as it should be): https://godbolt.org/z/fxqTzYfPv
Related proposed downstream Pebble patch: canonical/pebble#455