Open catenacyber opened 3 years ago
It still does not work on my laptop.
Any update on this issue?
I encountered the same problem with the latest Go 1.20. Unfortunately, it's in a proprietary software, but also applies to a generated file -- in our case by Ragel. I'll try to find reproducer for this.
friendly ping @golang/runtime ?
This is also still broken for our repo and hampers development
@neild the line directive strikes again it seems (messing up line numbers between the generated file and the generating file)
Is there a workaround? My project does have generated code from goyacc FWIW.
It seems that //line
directives inserted into generated parser by goyacc result in invalid entries in coverprofile.
The workaround could be to disable line directives via -l
flag, see https://github.com/zalando/skipper/pull/2450.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It is indeed the latest release
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
git clone https://github.com/prometheus/prometheus cd prometheus/promql/parser go test -coverprofile=wrong.out go tool cover -html wrong.out
What did you expect to see?
Get the HTML coverage report
What did you see instead?
Error message
cover: inconsistent NumStmt: changed from 2 to 1
The wrong.out contains indeed (running
grep generated_parser.y.go wrong.out | grep 178
I found this by modifying the
cover
message with adding%#+v
about other fields