Comments (6)
This happens on our developer machines but not in our CI system.
Eventually tracked down a way to make them behave the same: Remove the 'pkg' directory before running the tests.
System info:
Linux VM running under OSX
go version go1.1.2 linux/amd64
from gocov.
The reason why this happens is that gocov tracks which statements (not lines) have been hit, and then annotates source based on the starting line of that statement. Since no statements start on lines 21-22, they're neither "hit" nor "missed".
This is as designed, though if you are interested in making the output better, I'll probably accept a pull request.
from gocov.
That makes sense. The inconsistency between CI & dev appears to be due to old package files getting used to run the tests (hence why clearing out the pkg folder fixes it).
Is it possible that gocov is using outdated / uninstrumented pkg files some of the time?
from gocov.
It didn't think so, but it sounds like it is. gocov creates a temporary directory in which the instrumented code is built, so there shouldn't be anything to clean up.
I didn't read your comment properly before, about it being different in dev/CI. That doesn't make sense to me; I'll have to investigate.
from gocov.
Did you mean that your CI system was reporting no MISS lines? I probably mistakenly thought you meant that it was reporting MISS for all the lines.
As for the discrepancy, I think that I'd need something reproducible to investigate. I've not witnessed this sort of issue before, and never had to remove any pkg directories.
from gocov.
I believe the discrepancy issue is fixed by 1f9133a. If you're still having issues, please update gocov, and if problems persist let me know. I'll close this for now.
from gocov.
Related Issues (20)
- [Question] Can i use gocov to get code coverage report for a go application if my tests are written in another framework using python HOT 3
- Does gocov not support generics in Go version 1.20? HOT 1
- Does gocov currently support generics,expected '(', found '[' (and 5 more errors)
- When the file size of coverage is large (420KB), generating json is very slow, taking several hours
- how to confirm the supported GO version of gocov
- gocov's result is different from go test HOT 1
- If a package has no test files, the lines in that package are not added to the total line count. HOT 10
- Pass arguments to go list HOT 4
- please tag a version, to make go modules usage easier HOT 2
- gocov: gocov report print total coverage NaN% when totalReached and totalStatements are zero
- gocov does not pass -tags parameter HOT 1
- What is the difference to the go standard tools?
- gocov failed when trying on file that has a formatting directive
- 按照指示安装不了,有什么国内的镜像地址吗 HOT 1
- go get doesn't install HOT 2
- the code source default is $GOROOT. whether the code source path can be specified by the user when using gocov convert? HOT 3
- Unable to use go install HOT 2
- gocov with go1.18 generics HOT 3
- [question] Is it possible to exclude a method from code coverage? HOT 1
- gocov with coverprofile raise error, the file path contains duplicate parts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gocov.