func (h PlaylistHandler) currentPlaylist(w http.ResponseWriter, playlist player.Playlist) error { // get the contents of the playlist currentTracks, err := playlist.List() if err != nil { log.Printf("Error getting playlist: %s", err) return err } j, _ := json.Marshal(currentTracks) w.Write(j) return err }