codecov/feedback

Go report 100% coverage while codecov reports less

Closed this issue · 10 comments

Describe the bug

I have a use case where go test -coverprofile=atomic reports a 100% coverage for a package but it shows as 98% only on codecov.

To Reproduce

type Matcher interface {
	Accept(book Book, order Order) bool
	Match(book Book, order Order, report *ExecutionReport) 
}

type Continous struct {}

func (c Continous) Accept(book Book, order Order) bool {
	// 100% covered code
	return true
}

func (c Continous) Match(book Book, order Order, report *ExecutionReport)  {
	// 100% covered code
}

type Close struct {}

func (c Close) Accept(book Book, order Order) bool {
	// 100% covered code
	return false
}

func (c Close) Match(book Book, order Order, report *ExecutionReport)  {
	// Since Close.Accept always returns false, the close.Match is never called
	// and therefore can not be covered in tests.
}

Expected behavior

Codecov to report 100% coverage like go test does.

Screenshots

Go

image

Codecov

image

Additional context
Add any other context about the problem here.

@sylr how are you uploading coverage reports to Codecov?

Github Actions:

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        files: ./coverage.txt

@sylr can you provide a commit SHA for this? Have you double-checked the coverage.txt file to see what it says for those lines?

4e0ec26d73a5af3589055819df9299863e77f220

github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:25.51,30.2 1 1
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:33.33,35.2 1 1
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:38.72,40.2 1 1
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:43.63,45.2 1 1
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:50.87,52.2 1 7
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:56.97,58.2 0 0
github.com/xxxxx/yyyyy/zzzzzz/matcher/close.go:62.98,64.2 0 0

This should have been handled in the uploader here. @sylr are you able to send a link to that commit from Codecov?

sylr commented

Sorry it's a private repository

@sylr can you supply a recent commit sha then? apologies, I didn't get a chance to check last time.

@sylr just a bump here, I'm sorry that this is taking so long