-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
lang: ast: Remove redundant nil check #731
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.
@purpleidea I apologize for the nil pointer panic introduced in the first commit. I have pushed a fix for the panic. Please approve the CI runs again 🙇♂️ . CI runs in my fork are now green https://github.com/Juneezee/mgmt/actions/runs/7677576810 |
@Juneezee Thanks for the patch-- just a quick question or two if you don't mind: |
@purpleidea Yup, I don't mind 😄
GitHub search. I was searching for "abstract syntax tree" to find some code for learning purposes. This repository is one of the top results on the first page. This was the search query that I used:
Yes! Absolutely!
|
Thanks for the info-- sorry what I mean was, what linting tool did you use to find the specific code changes to make, or did you read through the whole file and decide on them manually?
Okay great! Want to give me a quick summary of your strengths and weaknesses in golang, if you're comfortable with golang concurrency, and what you'd like to work on. Eg: parser stuff, a resource, a function, concurrency bugs etc... I can help you choose and mentor you on your patches. Cheers! |
I did skim through the whole file. I use GoLand and I noticed the slice declaration warning, which is just 1 line above my change.
I would say I'm pretty confident in normal day-to-day Go programming, and I'm comfortable with Go concurrency too. However, I lack experience with project architecture and engineering practices (stuff like that). If there are issues or feature requests that you think are beginner-friendly, feel free to assign them to me and I am happy to work on it 😄 Thank you very much! |
Interesting, I didn't consider this a bad practice. I'll look into it more.
Okay, since you mentioned AST's and compilers, I wrote up an issue over here... #732 If you're interested in that one, LMK and comment over there that you're working on it. If you want something different, please LMK. |
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.
Looks good, just the one change throughout as mentioned and please rebase into a single commit against master. Thank you!
From the Go specification [1]: "1. ... For a nil slice, the number of iterations is 0." Therefore, an additional nil check for around the loop is unnecessary. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun <[email protected]>
LGTM, let's see what CI says... Thanks! |
Merged, thank you! What's next? |
I'll be looking into #732, and I hope I can solve it |
From the Go specification 1:
Therefore, an additional nil check for around the loop is unnecessary.
/cc @purpleidea for review
Footnotes
https://go.dev/ref/spec#For_range ↩