package main import "fmt" type Registry interface { Register(address string, id string) error Get(id string) (*string, error) } type MemoryRegistry struct { registry map[string]string } func (r *MemoryRegistry) Register(address string, id string) error { r.registry[id] = address return nil } func (r *MemoryRegistry) Get(id string) (*string, error) { addr, ok := r.registry[id] if !ok { return nil, fmt.Errorf("id not found") } return &addr, nil }