refactor: use slices.Contains to simplify code

Signed-off-by: tongjicoder <tongjicoder@icloud.com>
This commit is contained in:
tongjicoder 2025-05-27 14:43:50 +08:00 committed by Nicolas De loof
parent d49a68ecbf
commit 2e71440bee
14 changed files with 32 additions and 47 deletions

View file

@ -20,12 +20,12 @@ import (
"context"
"fmt"
"io"
"slices"
"strings"
"sync"
"time"
"github.com/docker/compose/v2/pkg/api"
"github.com/docker/compose/v2/pkg/utils"
"github.com/buger/goterm"
"github.com/docker/go-units"
@ -77,7 +77,7 @@ func (w *ttyWriter) Event(e Event) {
}
func (w *ttyWriter) event(e Event) {
if !utils.StringContains(w.eventIDs, e.ID) {
if !slices.Contains(w.eventIDs, e.ID) {
w.eventIDs = append(w.eventIDs, e.ID)
}
if _, ok := w.events[e.ID]; ok {