Hacker News new | ask | show | jobs
by alpb 264 days ago
It's my common code review comment to the beginners to not embed structs. There's rarely anything to be gained by doing so. The only use case I found to be useful is to embed something like:

    type MockHandlers struct {
        UnimplementedHandlers
    }

    func (m MockServer) LoginHandler{ /* ... */ }
where I get to override only a part of a bigger interface at a time and have the embedding take care of the rest by saying panic("unimplemented") to satisfy the interface.