go fix: use (*sync.WaitGroup).Go

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 47fba7e4b1)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Aleksa Sarai
2026-03-12 20:03:38 +09:00
committed by Kir Kolyshkin
parent b66fa4c218
commit a7dc07d5af
2 changed files with 6 additions and 12 deletions
+2 -4
View File
@@ -53,16 +53,14 @@ information is displayed once every 5 seconds.`,
events = make(chan *types.Event, 1024)
group = &sync.WaitGroup{}
)
group.Add(1)
go func() {
defer group.Done()
group.Go(func() {
enc := json.NewEncoder(os.Stdout)
for e := range events {
if err := enc.Encode(e); err != nil {
logrus.Error(err)
}
}
}()
})
if context.Bool("stats") {
s, err := container.Stats()
if err != nil {
+4 -8
View File
@@ -117,17 +117,13 @@ func handleSingle(path string, noStdin bool) error {
wg sync.WaitGroup
inErr, outErr error
)
wg.Add(1)
go func() {
wg.Go(func() {
_, outErr = io.Copy(os.Stdout, c)
wg.Done()
}()
})
if !noStdin {
wg.Add(1)
go func() {
wg.Go(func() {
_, inErr = io.Copy(c, os.Stdin)
wg.Done()
}()
})
}
// Only close the master fd once we've stopped copying.