Skip to content

Commit 5919fcb

Browse files
committed
Revert "Fix Goroutine leak in v2/command/formatter"
1 parent 4671e69 commit 5919fcb

File tree

4 files changed

+2
-24
lines changed

4 files changed

+2
-24
lines changed

cmd/formatter/colors.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,8 @@ func rainbowColor() colorFunc {
9292
}
9393

9494
var loop = make(chan colorFunc)
95-
var quitChan = make(chan bool)
96-
97-
func cleanInfiniteGoroutine() {
98-
quitChan <- true
99-
}
10095

10196
func init() {
102-
defer cleanInfiniteGoroutine()
10397
colors := map[string]colorFunc{}
10498
for i, name := range names {
10599
colors[name] = makeColorFunc(strconv.Itoa(30 + i))
@@ -122,14 +116,8 @@ func init() {
122116
}
123117

124118
for {
125-
select {
126-
case <-quitChan:
127-
return
128-
default:
129-
loop <- rainbow[i]
130-
i = (i + 1) % len(rainbow)
131-
}
119+
loop <- rainbow[i]
120+
i = (i + 1) % len(rainbow)
132121
}
133122
}()
134-
135123
}

cmd/formatter/formatter_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"io"
2323
"testing"
2424

25-
"go.uber.org/goleak"
2625
"gotest.tools/v3/assert"
2726
)
2827

@@ -72,8 +71,3 @@ func TestPrint(t *testing.T) {
7271
{"Name":"myName2","Status":"myStatus2"}
7372
`)
7473
}
75-
76-
// Test the absence of unexpected goroutines.
77-
func TestColorsGoroutinesLeak(t *testing.T) {
78-
goleak.VerifyNone(t)
79-
}

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ require (
150150
sigs.k8s.io/yaml v1.2.0 // indirect
151151
)
152152

153-
require go.uber.org/goleak v1.1.12
154-
155153
replace (
156154
// Override for e2e tests
157155
github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl
770770
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
771771
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
772772
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
773-
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
774773
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
775774
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
776775
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
@@ -979,7 +978,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
979978
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
980979
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
981980
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
982-
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
983981
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
984982
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
985983
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)