From fb46a912f70455376a3fe230ef5f5d78fb22a501 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 9 Oct 2023 00:05:28 +0400 Subject: [PATCH] In song.go updated comments. --- internal/radio/song.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/radio/song.go b/internal/radio/song.go index 074b7e1..ba4ef47 100644 --- a/internal/radio/song.go +++ b/internal/radio/song.go @@ -39,6 +39,8 @@ func (s *Song) MarshalJSON() ([]byte, error) { StartAt: s.StartAt.UTC().Format(time.RFC3339)}) } +// SongList holds a currently playing song and a list of previously played ones +// with a maximal length of maxLen. type SongList struct { sync.RWMutex current Song @@ -69,7 +71,7 @@ func (sl *SongList) Add(newSong Song) { sl.current = newSong } -// Current returns a currently playing song. +// Current returns a currently playing song or nil if it isn't set yet. func (sl *SongList) Current() *Song { sl.RLock() defer sl.RUnlock() @@ -101,7 +103,7 @@ func (sl *SongList) List() []Song { return sl.lastSongs } -// MaxLen returns a maximal length of a list +// MaxLen returns a maximal length of a song list. func (sl *SongList) MaxLen() int { return sl.maxLen }