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
Unused marks the capHeader.version field as unused (in our code that field is never referenced).
(I assume you get the idea but if it's not clear I'll make exact repro code.)
I think that if you define a struct S, if there's ever code that does unsafe.Pointer(&s) (where s is an S) then all of S's fields should be assumed used.
The text was updated successfully, but these errors were encountered:
(We've previously talked about this at dominikh/go-unused#37. The check I implemented there looks for (T)(unsafe.Pointer(v), it doesn't consider x = unsafe.Pointer(v). Will fix.)
(I feel like we've discussed this before, but I couldn't find an issue. Sorry if this is a duplicate.)
Right now if you have an unexported struct with unexported fields that you use for unsafe purposes the fields get marked as U1000.
For instance, we have some code which deals with Linux capabilities and needs to mirror some kernel structs. It's basically this code:
https://github.com/syndtr/gocapability/blob/d98352740cb2c55f81556b63d4a1ec64c5a319c2/capability/syscall_linux.go#L14-L39
Unused marks the capHeader.version field as unused (in our code that field is never referenced).
(I assume you get the idea but if it's not clear I'll make exact repro code.)
I think that if you define a struct S, if there's ever code that does
unsafe.Pointer(&s)
(where s is an S) then all of S's fields should be assumed used.The text was updated successfully, but these errors were encountered: