Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goroutine leak detected #1

Closed
nghiant3223 opened this issue Jul 24, 2022 · 1 comment
Closed

Goroutine leak detected #1

nghiant3223 opened this issue Jul 24, 2022 · 1 comment

Comments

@nghiant3223
Copy link

nghiant3223 commented Jul 24, 2022

I added a test file main_test.go with the following content:

package main

import "testing"

func TestX(t *testing.T) {
	if 1 != 2 {
		t.Fail()
	}
}

Then I ran this test file and got the following output (which is fine):

--- FAIL: TestX (0.00s)
FAIL
exit status 1
FAIL    github.com/haunt98/go-test-color        0.333s
2022/07/24 14:28:42 Failed to wait: exit status 1

When I added a time.Sleep(2*time.Second) at line 64 to mimic a very costly operation and ran the test again, I got the following result:

--- FAIL: TestX (0.00s)
FAIL
2022/07/24 14:31:32 Failed to wait: exit status 1

The above result doesn't contain execution time of this test package (FAIL github.com/haunt98/go-test-color 0.333s). Thus, goroutine leak is happening with your code.

@haunt98
Copy link
Owner

haunt98 commented Aug 13, 2022

@nghiant3223 Please try again to make sure new fix is worked for you

Screen.Recording.2022-08-13.at.4.51.49.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants