-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/cover: inconsistent NumStmt error #30746
Comments
I agree that this seems to be the same as #27350, which is fixed in 1.12 but not in 1.11.5. You should either update to 1.12 or run gofmt on the file in question. |
Using 1.12 without gofmt resulted in same error. Using 1.12 and running |
Reopening, just in case it's not a duplicate. |
I went through the steps you outlined using Go 1.12 and I could not recreate the problem. Can you double check that you were using Go 1.12 for all steps? Thanks. |
I tried as well and could not reproduce the problem with Go 1.12. |
Somehow I am able to reproduce this every time. Here is my current test script: test.sh
#!/bin/env bash
set -x
WORKDIR=/spare/local/tmp
# go
cd $WORKDIR
curl -sO https://dl.google.com/go/go1.12.linux-amd64.tar.gz
tar xzf go1.12.linux-amd64.tar.gz
# env
GOROOT=$WORKDIR/go
GOCACHE=$WORKDIR/gocache
GOPATH=$(mktemp -d -p $WORKDIR)
mkdir -p $GOPATH/bin $GOPATH/src $GOPATH/pkg
PATH=$GOROOT/bin:$GOPATH/bin:$PATH
# sanity check
go version
go env
# dep
go get -d -u github.com/golang/dep
cd $GOPATH/src/github.com/golang/dep
DEP_LATEST=$(git describe --abbrev=0 --tags)
git checkout $DEP_LATEST
go install -ldflags="-X main.version=$DEP_LATEST" ./cmd/dep
git checkout master
# telegraf
mkdir -p $GOPATH/src/github.com/influxdata/telegraf
cd $GOPATH/src/github.com/influxdata/telegraf
git clone https://github.com/influxdata/telegraf.git .
git checkout 1.10.0
dep ensure -vendor-only
# tests
go test -timeout 120s -short -covermode atomic -cover -coverprofile profile.out ./...
# cover sanity check
go tool cover -V
go tool cover -func=profile.out Here is the output:
|
Thanks, with that I was able to recreate the problem. |
Change https://golang.org/cl/167257 mentions this issue: |
Change https://golang.org/cl/167740 mentions this issue: |
This fixes TestFuncWithDuplicateLines (introduced in CL 167257) in module mode. Updates #30746 Updates #30228 Change-Id: I7b3e7192ae23f855c373e881389874ff6ffd49ad Reviewed-on: https://go-review.googlesource.com/c/go/+/167740 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, also occurs for go version go1.12 linux/amd64
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
go tool cover
output without errorWhat did you see instead?
Related?
This seems to be the same as issue #27350, which is marked as merged/closed. The code for which
cover
fails on are in (https://github.com/influxdata/telegraf/blob/1.10.0/plugins/parsers/influx/machine.go).The text was updated successfully, but these errors were encountered: