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/go: In PowerShell parsing fails for -coverprofile w/ file w/ extension (e.g. c.out) #72015

Closed
jfoshee opened this issue Feb 27, 2025 · 2 comments

Comments

@jfoshee
Copy link

jfoshee commented Feb 27, 2025

Go version

go version go1.24.0 windows/amd64

Output of go env in your module/workspace:

set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=0
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\JacobFoshee\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\JacobFoshee\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\JACOBF~1\AppData\Local\Temp\go-build2346486107=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=C:\Source\keyman\go.mod
set GOMODCACHE=C:\Users\JacobFoshee\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\JacobFoshee\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\JacobFoshee\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.0
set GOWORK=
set PKG_CONFIG=pkg-config

What did you do?

Using Windows PowerShell, executing:

go test -coverprofile=c.out

Produces the output:

# .out
no required module provides package .out; to add it:
        go get .out
FAIL    .out [setup failed]
FAIL

If I remove the file extension, it works fine, e.g.:

go test -coverprofile=coverage

If I run the command in a Bash shell on the same system it works as advertised.

What did you see happen?

go test -coverprofile=c.out 
# .out
no required module provides package .out; to add it:
        go get .out
FAIL    .out [setup failed]
FAIL

What did you expect to see?

go test -coverprofile=c.out
PASS
coverage: 73.9% of statements
ok      github.com/jfoshee/keyman/keyman        0.370s
@seankhliao
Copy link
Member

This is a powershell bug PowerShell/PowerShell#6291

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2025
@jfoshee
Copy link
Author

jfoshee commented Feb 27, 2025

Ah, thank you. And thanks for including the reference. 🙏

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