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
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.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
The rewrite of unused no longer flags the following code:
This is caused by the SSA that go/ssa produces:
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
generates
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.
The text was updated successfully, but these errors were encountered: