The Prototype pattern: potential type mismatches
Author: horwCreated Oct 25, 2023Updated Oct 25, 2023
Hi, perhaps this example isn't the best one because there's a potential for type mismatches. If we want to use type matching here, perhaps 'switch' is a better choice; or at least I think using the following type checking method would be better.
t1, ok := c.(*Type1)
if !ok {
t.Fatal("error")
}Source: senghoo/golang-design-pattern