From 1b5dea899e64535b3b783173881e90d00b5e867f Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 2 Apr 2022 02:00:28 +0400 Subject: [PATCH] I found why time was being further altered. The reason is that slices are pointing to original array. Okay. The problem fixed. --- internal/radio/icecast.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index c8f92d6..516235e 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -73,7 +73,9 @@ func IcecastLastPlayedSongs(lastNSongs int, playlistPath string) ([]Song, error) if lastNSongs > lpcLen { lastNSongs = lpcLen } - return lastPlayedCache[lpcLen-lastNSongs:], nil + var ret []Song = make([]Song, lastNSongs) + copy(ret[:], lastPlayedCache[lpcLen-lastNSongs:]) + return ret, nil } }