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

cmd/cover: Compilation error when using -covermode=atomic on a file without a newline at the end #59081

Closed
jerbob92 opened this issue Mar 16, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jerbob92
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20.2 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jeroen/.cache/go-build"
GOENV="/home/jeroen/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jeroen/go/pkg/mod"
GONOPROXY="s"
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jeroen/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jeroen/Projects/OpenSource/go-pdfium/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1981126242=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Recently I started upgrading go-pdfium to the latest version of pdfium (it's a CGO wrapper), I'm also upgrading to the latest Go in the test/coverage matrix.

When I completed the upgrades, I noticed that my go test -coverprofile=coverage.out -covermode=atomic command that generates the code coverage is broken in go 1.20, while it did work in 1.19.

It resulted in the following error: https://github.com/klippa-app/go-pdfium/actions/runs/4441302163/jobs/7796211682

I later found out that this was related to the file not having a newline at the end, the following commit fixed it:
klippa-app/go-pdfium@788fce4

I don't really know how the file ended up in this state, but since it worked in 1.19, and go build/go test (with -coverprofile but without -covermode=atomic) did still work, I wanted to report it anyway, also because @bcmills said the cover implementation changed drastically in 1.20.

What did you expect to see?

The result of the code coverage.

What did you see instead?

Error: internal/implementation_cgo/fpdf_formfill_experimental.go:285:2: expected ';', found 'var'

@bcmills
Copy link
Contributor

bcmills commented Mar 16, 2023

(attn @thanm)

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. compiler/runtime Issues related to the Go compiler and/or runtime. labels Mar 16, 2023
@bcmills bcmills added this to the Backlog milestone Mar 16, 2023
@thanm thanm self-assigned this Mar 27, 2023
@thanm
Copy link
Contributor

thanm commented Mar 27, 2023

@jerbob92 thanks for the report.

This issue looks to be a duplicate of #58370, now fix at tip (will be released as part of Go 1.21).

@thanm
Copy link
Contributor

thanm commented Mar 27, 2023

Dup of #58370.

@thanm thanm closed this as completed Mar 27, 2023
@golang golang locked and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants