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: do not check static-msg for With functions #45

Merged
merged 1 commit into from
May 27, 2024

Conversation

tigrato
Copy link
Contributor

@tigrato tigrato commented May 27, 2024

In With functions, msgPos := funcInfo.argsPos - 1 resolves to -1 because these functions do not have a message argument. This causes a panic when static-msg is enabled. Added a check to ensure msgPos is valid before proceeding.

Fixes #46

`With` functions have no message so `msgPos := funcInfo.argsPos - 1`
resolves to `-1` which causes issues when `static-msg` is enabled.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Copy link

codecov bot commented May 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.58%. Comparing base (f87bbdf) to head (26938aa).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
- Coverage   84.06%   83.58%   -0.48%     
==========================================
  Files           2        2              
  Lines         251      262      +11     
==========================================
+ Hits          211      219       +8     
- Misses         33       35       +2     
- Partials        7        8       +1     

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

@tigrato tigrato changed the title chore: prevent panic when using static-msg fix: prevent panic when using static-msg May 27, 2024
@tmzane tmzane self-requested a review May 27, 2024 20:52
@tmzane tmzane changed the title fix: prevent panic when using static-msg fix: do not check static-msg for With functions May 27, 2024
@tmzane tmzane merged commit 8c135a1 into go-simpler:main May 27, 2024
10 checks passed
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.

runtime error: index out of range [-1]
2 participants