package stdoutpub import ( "fmt" "os" ) const outPrefix = "Result: " func NewService() Service { return Service{ fd: os.Stdout, } } type Service struct { fd *os.File } func (s Service) Publish(i int64) error { if _, err := fmt.Fprintf(s.fd, "%s%d\n", outPrefix, i); err != nil { return fmt.Errorf("write to file: %w", err) } return nil }