-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding support for detecting nested contexts in function literals #18
Adding support for detecting nested contexts in function literals #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests, linter is updated, tests should be added to cover the expected case
Hi! Thank you for your contribution :) |
Hi, i am currently away from my laptop. i'll update this soon.
…On Sun, 25 Aug, 2024, 19:32 Gabriel Augendre, ***@***.***> wrote:
Hi! Thank you for your contribution :)
I've updated master to always run all test suites + dropped support for go
1.21.
Could you please rebase? At first it looks like your changes aren't
compatible with go >=1.22 but I'd like to confirm that.
—
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJOI74G7SKFE46334YSEP2LZTHPYXAVCNFSM6AAAAABNB4S7R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYHA3DCOJQHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
e482fa4
to
89a1841
Compare
After rebasing, i found tests are failing only for go 1.22 (and not for older version). The reason being go 1.22 changed the way
In go 1.21, the scope of variable I have made some changes to handle this. |
my new change also handles this case, which is giving a false positive on
|
Thanks! Released in v0.5.0 |
Function literals are usually called multiple times during their lifetime (consider middlewares, mapping functions etc). If they are modifying a context variable that was defined out of their scope - maybe in the parent function- it can very quickly bloat the original context variable. This can cause memory leak. I have experienced the same while working with golan with at my day job.
I think this change will help catch many such bugs.
I have also added testcases for this and have improved the identifier scope checking logic.