func NewWatcher(
	lister ListerService,
	interval time.Duration,
	opts ...func(*WatcherConfig),
) *Watcher {
	cfg := WatcherConfig{
		Logger: zero.Logger(),
	}
	for _, opt := range opts {
		opt(&cfg)
	}
	w := &Watcher{
		lister: lister,
		streamer: stream.NewPoller(
			func() (zero.Interface, error) {
				return lister.ListGoRepos()
			},
			interval,
		),
		log: cfg.Logger,
	}
	go w.run()
	return w
}
NewWatcher creates a new Watcher, which keeps an updated list of
Go repositories, and checks for updates at regular intervals.
package repo
import (
	"sync"
	"time"
	"github.com/cockroachdb/errors"
	"github.com/sirupsen/logrus"
	"go.stevenxie.me/api/pkg/stream"
	"go.stevenxie.me/api/pkg/zero"
)