Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit eb618aa

Browse files
committed
fixup! Add new clog.ErrGroup
1 parent 99a751f commit eb618aa

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

internal/clog/errgroup.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
//
1313
// Take for example, a case in which we are concurrently stopping a slice of environments.
1414
// In this case, we want to log errors as they happen, not pass them through the callstack as errors.
15-
// When the operations complete, we want to log how many, if any, failed.
15+
// When the operations complete, we want to log how many, if any, failed. The caller is still expected
16+
// to handle success and info logging.
1617
type ErrGroup interface {
1718
Go(f func() error)
1819
Wait() error
@@ -23,8 +24,8 @@ type group struct {
2324
failures int32
2425
}
2526

26-
// NewErrGroup gives an error group with logging and error propagation handled automatically.
27-
func NewErrGroup() ErrGroup {
27+
// LoggedErrGroup gives an error group with error logging and error propagation handled automatically.
28+
func LoggedErrGroup() ErrGroup {
2829
return &group{
2930
egroup: errgroup.Group{},
3031
failures: 0,

internal/cmd/envs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ coder envs --user charlie@coder.com ls -o json \
100100
return xerrors.Errorf("new client: %w", err)
101101
}
102102

103-
egroup := clog.NewErrGroup()
103+
egroup := clog.LoggedErrGroup()
104104
for _, envName := range args {
105105
envName := envName
106106
egroup.Go(func() error {

0 commit comments

Comments
 (0)