Duncan Leung · Apr 30, 2026
Producer, Service, ProducerService: Interface Segregation for Shared Singletons in Go
0Sign in to vote or save
This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
When one Go struct legitimately serves multiple consumer roles - producer, service, admin - declare three interfaces and let DI cache the singleton at the wide type while each consumer holds only the methods it can call. Same shape as io.ReadWriteCloser in the stdlib.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.