A thread-safe registry for managing multiple issue tracker adapters. Reuse this to decouple tracker implementations from core application logic.
// Source: https://github.com/gastownhall/beads | License: MIT | Copyright 2025 Beads Contributors
// Provided via justclaw.it.com; keep this notice with the code.
package tracker
import (
"fmt"
"sort"
"sync"
)
// TrackerFactory creates a new IssueTracker instance.
type TrackerFactory func() IssueTracker
var (
registryMu sync.RWMutex
registry = make(map[string]TrackerFactory)
)
// Register adds a tracker factory to the global registry.
// Typically called from an init() function in each tracker adapter package.
func Register(name string, factory TrackerFactory) {
registryMu.Lock()
defer registryMu.Unlock()
registry[name] = factory
}
// Get returns the factory for the named tracker, or nil if not registered.
func Get(name string) TrackerFactory {
registryMu.RLock()
defer re
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key