diff --git a/examples/pubsub/chat/ui.go b/examples/pubsub/chat/ui.go index 165f67685e..51725bd1bb 100644 --- a/examples/pubsub/chat/ui.go +++ b/examples/pubsub/chat/ui.go @@ -121,10 +121,8 @@ func (ui *ChatUI) end() { func (ui *ChatUI) refreshPeers() { peers := ui.cr.ListPeers() - // clear is not threadsafe so we need to take the lock. - ui.peersList.Lock() + // clear is thread-safe ui.peersList.Clear() - ui.peersList.Unlock() for _, p := range peers { fmt.Fprintln(ui.peersList, shortID(p))