Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/cover: incorrect coverage for source file generated by x/tools/cmd/goyacc #33690
What version of Go are you using?
go version go1.12.7 windows/amd64
What did you do?
What did you expect to see?
What did you see instead?
y.go lines 25 to 27 contain:
There is no code to be covered here, and these lines do not form a block at all.
Some lines below that, y.go contains:
The output of
This makes me suspect that the file name
@adam-azarchs I tried your suggestion, and it works partially. The thing that works is the coverage, in that I found two branches of my code that are not yet covered. The downside though is that to achieve 100% code coverage, I would now have to cover all goyacc error cases now, and maybe even trigger impossible situations. The goyacc code has worked for me, and I'm not willing to test it thoroughly. Therefore I consider the
My point is that this isn't a problem with
In terms of code coverage numbers, I'm not sure what you're expecting. Do you want to cover everything in the generated code or not? It sounds like you don't, but then what exactly do you want to ensure coverage of?
If there is a
I want to ensure coverage of all the code I have written myself in the yacc source file, as you said.
I think that the output of gocover should include the yacc source file. I usually make the code in the yacc source file minimal, as that file has less IDE support than regular go source. Therefore having the coverage of the individual lines in the yacc file is sufficient to me. I don't need the column information.