Skip to content
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

Issue: failed to parse profiles: line...doesn't match expected format: couldn't find a before #9

Open
devplayerJoe opened this issue Mar 30, 2021 · 4 comments

Comments

@devplayerJoe
Copy link

Go version (go version)?

$ go version
go version go1.13.9 darwin/amd64

Details about the operating system and processor architecture (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/Library/Caches/go-build"
GOENV="$HOME/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="$HOME/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="$HOME/go/project1/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nt/gc7658bs1132ttlcjdmlwwxm0000gn/T/go-build221587211=/tmp/go-build -gno-record-gcc-switches -fno-common"

Problem statement

I am generating respective coverage files for each _test.go file. However, I am getting an error while executing the gocovmerge command from last few days. I first encountered it on 25 March, then on 26-27 March, it worked fine. But again from 28-29 March, I am facing the same issue again.

Executed below command to generate merged coverage profile file

gocovmerge ${coverageDir}/myTest-*-coverage.profile

Expected outcome?

Merged coverage profile file being generated without any error

Observed output?

2021/03/30 01:43:34 failed to parse profiles: line "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" doesn't match expected format: couldn't find a   before Count

Kindly assist in nailing down the issue.

@devplayerJoe
Copy link
Author

@wadey, could you please assist?

@wadey
Copy link
Owner

wadey commented Mar 31, 2021

Check all of your myTest-*-coverage.profile files, it looks like one of them has invalid binary data in it (zero bytes). These should all be text files and not contain zero bytes.

@devplayerJoe
Copy link
Author

Got one coverage file having binary data. There are 40 ish test patterns for unit tests and all of them are creating separate coverage profile file ${profileName}.profile with command:
go test -p 1 -cover -v ./${pkgName} -run ${pattern} -coverprofile=${profileName}.profile ./${pkgName}
All other files are 1M in size and only file containing binary data in end has size 148K.
Any pointers on why it could happen?

@wadey
Copy link
Owner

wadey commented Mar 31, 2021

Perhaps the go test run is failing or calling os.Exit incorrectly? I would regenerate all of your .profile files to see which one is the issue and then investigate that test suite to see why it's being generated incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants