I do not assume you require an exterior reliance for something this simple. Produce an international variable of some kind, guard it with a mutex so it’s thread-safe, after that upgrade it based upon some type of period. Something like:
// AppMenu shops the international application food selection products
kind AppMenu struct {
Products [] string.
}
var (.
muAppMenu = && sync.RWMutex {}// Guards 'appMenu'.
appMenu AppMenu.
).
// GetAppMenu returns the existing application food selection.
func GetAppMenu() AppMenu {
muAppMenu.RLock().
food selection:= appMenu.
muAppMenu.RUnlock().
return food selection.
}
// SetAppMenu establishes the application food selection.
func SetAppMenu( food selection AppMenu) {
muAppMenu.Lock().
appMenu = food selection.
muAppMenu.Unlock().
}
You might after that someplace in your primary feature rotate up a goroutine to upgrade your food selection product home occasionally:
// Context for our goroutine.
ctx, terminate:= context.WithCancel( context.Background()).
postpone terminate().
// Rotate up goroutine to upgrade application food selection products every 30 secs.
go func() {
t:= time.NewTicker( 30 * time.Second).
postpone t.Stop().
for {
choose {
instance <