You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the "Expressions should not be cuddled with declarations or returns" message on line 2 in the following example:
varwg sync.WaitGroupwg.Add(2)
Since I'm performing an action (calling a function) on the variable declared in the line above I feel like cuddling should be okay and this shouldn't give off a warning.
Thoughts?
The text was updated successfully, but these errors were encountered:
I think var is something that should be used to group and separate setup/declarations in functions or in a global scope and be separated from the rest of the codebase. However there are two easy ways to solve this.
Okay, your reasoning makes sense to me so I'm going to try to follow it and will just go with the 2. way (assigning instead of declaring).
Somehow I had imprinted in me that empty structs should be declared with var but from what I can gather there's no difference between declaring like that vs. assigning and initializing an empty struct.
Hey, thanks for your work.
I'm getting the "Expressions should not be cuddled with declarations or returns" message on line 2 in the following example:
Since I'm performing an action (calling a function) on the variable declared in the line above I feel like cuddling should be okay and this shouldn't give off a warning.
Thoughts?
The text was updated successfully, but these errors were encountered: