I have some differences between these 2 versions on test coverage across 
packages.
I don't know if it's a bug or a new behavior.
In 1.23.8, a test run in one package also report coverage of functions used 
in other package. It's not the case with 1.24.10.
Example:
version 1.23.8
E:\\coverTest>go1.23.8.exe test -v test/test/pkg2 test/test/pkg1 
-coverprofile=coverage.out
        test/test/pkg1          coverage: 0.0% of statements
=== RUN   TestFunc2
--- PASS: TestFunc2 (0.00s)
=== RUN   TestFunc2_ReturnsNonEmptyString
--- PASS: TestFunc2_ReturnsNonEmptyString (0.00s)
=== RUN   TestFunc2_ContainsExpectedPrefix
--- PASS: TestFunc2_ContainsExpectedPrefix (0.00s)
PASS
coverage: 100.0% of statements
ok      test/test/pkg2  1.025s  coverage: 100.0% of statements

E:\coverTest>go1.23.8.exe tool cover -func coverage.out
*test/test/pkg1/file1.go:3:      Func1           100.0%*
test/test/pkg2/file1.go:5:      Func2           100.0%
total:                          (statements)    100.0%

version 1.24.10
E:\coverTest>go1.24.10.exe test -v test/test/pkg2 test/test/pkg1 
-coverprofile=coverage.out
=== RUN   TestFunc2
--- PASS: TestFunc2 (0.00s)
=== RUN   TestFunc2_ReturnsNonEmptyString
--- PASS: TestFunc2_ReturnsNonEmptyString (0.00s)
=== RUN   TestFunc2_ContainsExpectedPrefix
--- PASS: TestFunc2_ContainsExpectedPrefix (0.00s)
PASS
coverage: 100.0% of statements
ok      test/test/pkg2  0.110s  coverage: 100.0% of statements
        test/test/pkg1          coverage: 0.0% of statements

E:\coverTest>go1.24.10.exe tool cover -func coverage.out
*test/test/pkg1/file1.go:3:      Func1           0.0%*
test/test/pkg2/file1.go:5:      Func2           100.0%
total:                          (statements)    50.0%


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/6378b57f-9c52-436d-8867-e0089b6a5ff1n%40googlegroups.com.

Reply via email to