Avatar ·

How to output text to console when testing in Go (testing package)?

Hello! I started learning Go and writing tests for my functions. I'm using the standard `testing` package. When I run tests via `go test`, I need to see intermediate results or debug information in the console. For example, I want to check that a variable has the correct value inside the test. I tried using `fmt.Println()` inside the test function, but the output doesn't appear. Here's my code: ```go func TestSum(t *testing.T) { result := Sum(2, 3) fmt.Println("Result is:", result) // I don't see this output! if result != 5 { t.Errorf("Expected 5, got %d", result) } } ``` When I run `go test`, I only see `PASS` or `FAIL`, but I don't see the line "Result is: 5". Why is this happening? How to properly output debug information in Go tests?