Skip to content

Commit f7805c5

Browse files
authored
Merge pull request #236 from ngrok/bmps/go-fix
chore: run go fix
2 parents 845f770 + f14dfdd commit f7805c5

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

internal/integration_tests/url_pooling_test.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,13 @@ func TestListenWithURLAndPooling(t *testing.T) {
6363

6464
// Start handlers for both listeners
6565
// Handler for first listener
66-
wg.Add(1)
67-
go func() {
68-
defer wg.Done()
66+
wg.Go(func() {
6967
defer close(processingDone)
7068

7169
// Signal that we're ready to accept connections
7270
endpoint1Ready.Signal()
7371

74-
for i := 0; i < 5; i++ { // Handle up to 5 connections
72+
for range 5 { // Handle up to 5 connections
7573
conn, err := listener1.Accept()
7674
if err != nil {
7775
// Check if test is already finished before reporting errors
@@ -130,17 +128,15 @@ func TestListenWithURLAndPooling(t *testing.T) {
130128
}
131129
}(conn)
132130
}
133-
}()
131+
})
134132

135133
// Handler for second listener
136-
wg.Add(1)
137-
go func() {
138-
defer wg.Done()
134+
wg.Go(func() {
139135

140136
// Signal that we're ready to accept connections
141137
endpoint2Ready.Signal()
142138

143-
for i := 0; i < 5; i++ { // Handle up to 5 connections
139+
for range 5 { // Handle up to 5 connections
144140
conn, err := listener2.Accept()
145141
if err != nil {
146142
// Check if test is already finished before reporting errors
@@ -199,7 +195,7 @@ func TestListenWithURLAndPooling(t *testing.T) {
199195
}
200196
}(conn)
201197
}
202-
}()
198+
})
203199

204200
// Wait for both endpoints to be ready to accept connections
205201
endpoint1Ready.Wait(t)

internal/legacy/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type testCases[T tunnelConfigPrivate, O any] []testCase[T, O]
5858
func (tc testCase[T, O]) Run(t *testing.T) {
5959
t.Run(tc.name, func(t *testing.T) {
6060
actualOpts, ok := tc.opts.(T)
61-
require.Truef(t, ok, "Tunnel opts should have type %v", reflect.TypeOf(new(T)))
61+
require.Truef(t, ok, "Tunnel opts should have type %v", reflect.TypeFor[*T]())
6262
if tc.expectForwardsTo != nil {
6363
require.Equal(t, *tc.expectForwardsTo, actualOpts.ForwardsTo())
6464
}
@@ -84,7 +84,7 @@ func (tc testCase[T, O]) Run(t *testing.T) {
8484
require.Nil(t, actualOpts.Opts())
8585
} else if tc.expectOpts != nil {
8686
opts, ok := actualOpts.Opts().(*O)
87-
require.Truef(t, ok, "Opts has the type %v", reflect.TypeOf((*O)(nil)))
87+
require.Truef(t, ok, "Opts has the type %v", reflect.TypeFor[*O]())
8888
tc.expectOpts(t, opts)
8989
}
9090
})

internal/tunnel/client/raw_session_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ testloop:
5050
r := NewRawSession(logger, muxado.Client(&dummyStream{}, nil), nil, nil)
5151

5252
wg := sync.WaitGroup{}
53-
wg.Add(1)
5453

5554
// Call onHeartbeat as fast as we can in the background.
56-
go func() {
57-
defer wg.Done()
55+
wg.Go(func() {
5856
for {
5957
select {
6058
case <-ctx.Done():
@@ -63,7 +61,7 @@ testloop:
6361
}
6462
r.(*rawSession).onHeartbeat(time.Millisecond*1, false)
6563
}
66-
}()
64+
})
6765

6866
// Verify that closing the session while a heartbeat is in flight won't
6967
// cause a panic

internal/tunnel/proto/msg.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func (ne ngrokError) Unwrap() error {
6161
func (ne ngrokError) Msg() string {
6262
errMsg := ne.Inner.Error()
6363
out := []string{}
64-
lines := strings.Split(errMsg, "\n")
65-
for _, line := range lines {
64+
lines := strings.SplitSeq(errMsg, "\n")
65+
for line := range lines {
6666
line = strings.Trim(line, " \t\n\r")
6767
if line == "" || ngrokErrorCodeRegex.MatchString(line) {
6868
continue

0 commit comments

Comments
 (0)