Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
satk0 committed Dec 23, 2024
1 parent c7f79ea commit ea7d38d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions internal/startup_manager/startup_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@ func TestAppServer(t *testing.T) {
}()

name := net.JoinHostPort("localhost", strconv.Itoa(cfg.Server.Port))
go func() {
go func(t *testing.T) {

Check failure on line 49 in internal/startup_manager/startup_manager_test.go

View workflow job for this annotation

GitHub Actions / Lint code

SA2002: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (staticcheck)
conn, err := net.DialTimeout("tcp", name, timeout)
if err != nil {
t.Fatalf("unexpected error: %v", err)

Check failure on line 52 in internal/startup_manager/startup_manager_test.go

View workflow job for this annotation

GitHub Actions / Lint code

testinggoroutine: call to (*testing.T).Fatalf from a non-test goroutine (govet)
}
if conn != nil {
defer conn.Close()
}
}()
sm.shutdownServer(ctx)
}(t)

err = sm.shutdownServer(ctx)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
})

t.Run("TLS", func(t *testing.T) {
Expand Down Expand Up @@ -96,16 +100,19 @@ func TestAppServer(t *testing.T) {

dialer := net.Dialer{Timeout: timeout}
name := net.JoinHostPort("localhost", strconv.Itoa(cfg.Server.Port))
go func() {
go func(t *testing.T) {

Check failure on line 103 in internal/startup_manager/startup_manager_test.go

View workflow job for this annotation

GitHub Actions / Lint code

SA2002: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (staticcheck)
conn, err := tls.DialWithDialer(&dialer, "tcp", name, tlsConfig)
if err != nil {
t.Fatalf("unexpected error: %v", err)

Check failure on line 106 in internal/startup_manager/startup_manager_test.go

View workflow job for this annotation

GitHub Actions / Lint code

testinggoroutine: call to (*testing.T).Fatalf from a non-test goroutine (govet)
}
if conn != nil {
defer conn.Close()
}
}()
}(t)

sm.shutdownServer(ctx)
err = sm.shutdownServer(ctx)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
})
}

0 comments on commit ea7d38d

Please sign in to comment.