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
The language spec defines this precisely, but in short, comparable types are boolean, numeric, string, pointer, channel, and interface types, and structs or arrays that contain only those types.
Below is a test for the issue I'm describing:
type Unhashable map[string]interface{}
func (u Unhashable) Close() error {
return nil
}
Convey("Validate death happens cleanly", t, func() {
u := make(Unhashable)
death := NewDeath(syscall.SIGTERM)
syscall.Kill(os.Getpid(), syscall.SIGTERM)
death.WaitForDeath(u)
})
At the moment death will panic because Unhashable is, well, unhashable, but also an io.Closer. See my suggested solution #17
In summary, it just uses the index of the io.Closer from the internal list of closers. My changes save that index in the closer{} to properly remove from the tracking map.
The text was updated successfully, but these errors were encountered:
This explains what is allowed as a key in a map.
Below is a test for the issue I'm describing:
At the moment death will panic because Unhashable is, well, unhashable, but also an io.Closer. See my suggested solution #17
In summary, it just uses the index of the io.Closer from the internal list of closers. My changes save that index in the closer{} to properly remove from the tracking map.
The text was updated successfully, but these errors were encountered: