Initial commit

This commit is contained in:
2024-05-30 19:42:26 +03:00
commit f04111c689
13 changed files with 455 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
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
}