Giter Club home page Giter Club logo

Comments (6)

DanielHeath avatar DanielHeath commented on August 20, 2024

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.

axw avatar axw commented on August 20, 2024

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.

DanielHeath avatar DanielHeath commented on August 20, 2024

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.

axw avatar axw commented on August 20, 2024

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.

axw avatar axw commented on August 20, 2024

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.

axw avatar axw commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.