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

fix(timeutil): remove unreachable panic() call #14427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thp-canonical
Copy link

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

Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thanks, this looks correct to me.

@ernestl ernestl added the Simple 😃 A small PR which can be reviewed quickly label Nov 25, 2024
Copy link
Collaborator

@ernestl ernestl left a comment

Choose a reason for hiding this comment

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

Thanks

@ernestl
Copy link
Collaborator

ernestl commented Nov 27, 2024

Rebased the branch to have workflows run correctly

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.03%. Comparing base (96ea7b0) to head (1e28d3c).
Report is 111 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14427      +/-   ##
==========================================
+ Coverage   78.95%   79.03%   +0.08%     
==========================================
  Files        1084     1087       +3     
  Lines      146638   147903    +1265     
==========================================
+ Hits       115773   116895    +1122     
- Misses      23667    23767     +100     
- Partials     7198     7241      +43     
Flag Coverage Δ
unittests 79.03% <100.00%> (+0.08%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simple 😃 A small PR which can be reviewed quickly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants