package convert import ( "strings" "sync" ) type Plugin interface { Apply(spec *Spec) } var ( pluginMu sync.RWMutex plugins = map[string]Plugin{} ) func Register(archKey string, p Plugin) { archKey = strings.ToLower(archKey) pluginMu.Lock() defer pluginMu.Unlock() plugins[archKey] = p } func pluginForArchitecture(architecture string) Plugin { archLower := strings.ToLower(architecture) pluginMu.RLock() defer pluginMu.RUnlock() for k, p := range plugins { if strings.Contains(archLower, k) { return p } } return nil }