From 1996743470f736f1158d8641e8046da157bf18a2 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 29 Aug 2022 09:08:08 +0400 Subject: [PATCH] Cache vars moved to the top of the file. --- internal/radio/icecast.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index 40a2dff..f8a48a2 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -22,6 +22,11 @@ const ( bufferSize = 8192 ) +var ( + lastPlayedCache []Song = make([]Song, 10) + lastPlayedCacheMutex sync.Mutex +) + type IcecastStatusDTO struct { Icestats struct { ServerStartISO8601 string `json:"server_start_iso8601"` @@ -158,8 +163,6 @@ func lastPlayedSong(playlistPath string) (*Song, error) { var playlistWatcher watcher.InotifyWatcher var playlistFired chan uint32 = make(chan uint32) -var lastPlayedCache []Song = make([]Song, 10) -var lastPlayedCacheMutex sync.Mutex func IcecastWatchPlaylist(playlistPath string, lastNSongs int) error { playlistWatcher, err := watcher.NewInotifyWatcher()