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: Support hexadecimal integers in conditions #563

Merged
merged 8 commits into from
Oct 5, 2023

Conversation

heitorPB
Copy link
Contributor

@heitorPB heitorPB commented Sep 6, 2023

Remove the assumption that JSON contains only decimal integers and instead identify the base from the prefix of the data.

strconv.ParseInt can identify the base of the integer based on its "prefix":

  • 0x -> hexadecimal
  • 0o -> octal
  • 0b -> binary
  • decimal otherwise.

Summary

Checklist

  • Tested and/or added tests to validate that the changes work as intended, if applicable.
  • Updated documentation in README.md, if applicable.

Remove the assumption that JSON contains only decimal integers and
instead identify the base from the prefix of the data.

`strconv.ParseInt` can identify the base of the integer based on its
"prefix":
- 0x -> hexadecimal
- 0o -> octal
- 0b -> binary
- decimal otherwise.
core/condition_test.go Show resolved Hide resolved
@TwiN TwiN changed the title Fix parsing hexadecimal integers in conditions fix: Parse hexadecimal integers in conditions Sep 30, 2023
core/condition_test.go Show resolved Hide resolved
@TwiN TwiN changed the title fix: Parse hexadecimal integers in conditions fix: Support hexadecimal integers in conditions Sep 30, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (e88bfa8) 80.30% compared to head (c5eb946) 80.32%.
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #563      +/-   ##
==========================================
+ Coverage   80.30%   80.32%   +0.02%     
==========================================
  Files          56       56              
  Lines        4489     4494       +5     
==========================================
+ Hits         3605     3610       +5     
  Misses        703      703              
  Partials      181      181              
Files Coverage Δ
core/condition.go 98.13% <100.00%> (+0.04%) ⬆️

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

@TwiN TwiN merged commit 744d63a into TwiN:master Oct 5, 2023
1 check passed
@TwiN
Copy link
Owner

TwiN commented Oct 5, 2023

Thank you for the contribution!

@heitorPB
Copy link
Contributor Author

heitorPB commented Oct 5, 2023

Thank you for Gatus and mentoring me in this issue :)

MelvinTo added a commit to MelvinTo/gatus that referenced this pull request Nov 10, 2023
* 'master' of https://github.com/TwiN/gatus: (97 commits)
  docs: add instruction to install as binary (TwiN#615)
  feat(alerting): make authentication optional for email provider (TwiN#608)
  feat(alerting): Add gotify provider (TwiN#605)
  chore(deps): bump github.com/coreos/go-oidc/v3 from 3.6.0 to 3.7.0 (TwiN#604)
  chore(deps): bump github.com/valyala/fasthttp from 1.49.0 to 1.50.0 (TwiN#594)
  Feat/modify discord title (TwiN#602)
  ui: Fix issue back button appearing over title when logo is too small
  feat(alerting): Add AWS SES Alerting Provider (TwiN#579)
  chore(deps): bump github.com/wcharczuk/go-chart/v2 from 2.1.0 to 2.1.1 (TwiN#591)
  ci: Increase timeout-minutes for test workflow to 10 minutes
  ui: Use localStorage instead of sessionStorage for refresh interval + collapsed groups
  ui(settings): Fix refresh interval padding
  chore(deps): bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (TwiN#586)
  chore(deps): bump modernc.org/sqlite from 1.24.0 to 1.26.0 (TwiN#585)
  fix: Support hexadecimal integers in conditions (TwiN#563)
  chore(deps): Bump github.com/TwiN/whois to v1.1.7
  chore(deps): Bump github.com/TwiN/whois to v1.1.7
  fix(alerting): Add support for client.insecure in email alerting provider (TwiN#583)
  chore(deps): bump github.com/gofiber/fiber/v2 from 2.46.0 to 2.49.2 (TwiN#584)
  docs: Clean up list of sponsors
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants