Here is the project test: https://drive.google.com/file/d/1ku2vLOqj9ITO_JsgSg_r4A_VJkvv-9-2/view?usp=drive_link
On Thursday, November 27, 2025 at 3:20:19 AM UTC+1 Laurent Caumont wrote: > 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/2a473e9f-93ae-4dbd-bf25-080005fd1727n%40googlegroups.com.
