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
{{ message }}
Repository navigation
unused: flag unused variables with initializers #507
Because the init function is taking addresses of values in x, x is clearly used.
This is not a problem for slices, because they generate different code (an array gets constructed, sliced, and assigned to the variable. Assignment alone isn't considered a use.)
This is, however, also a problem for structs, as
var x = t{1}
generates
t1 = &x.x [#0] *int
*t1 = 1:int
Another annoying side effect of this is that function calls used as part of the initialization are marked as used by the init function, not the variable.
Activity
[-]unused: flag unused variables of type array[/-][+]unused: flag unused variables with initializers[/+]unused: reimplement check using the AST