3 ms·
From the readme: > The go-sumtype command recognizes this pattern, but it needs a small amount of help to recognize which interfaces should be treated as sum t
by infogulch 10y ago
From the readme:
> The go-sumtype command recognizes this pattern, but it needs a small amount of help to recognize which interfaces should be treated as sum types
Why is this? Have you tried detecting sum types automatically? Maybe some heuristics like: package-level declaration of the interface, has an unexported method, has more than one type that implements it, maybe also the interface itself is exported.
- burntsushi 10y agoIt seems unwise to do exhaustiveness checks automatically on an interface that "might" be a sum type. The declaration is a single line and has the benefit of being completely unambiguous.