Skip to content

cmd/go: flags ending with "=." is not correctly parsed by go tool when run via powershell #43179

Closed
@maruel

Description

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

$ go1.15.6 version
go version go1.15.6 windows/amd64

Does this issue reproduce with the latest release?

Yes. Reproduces on go1.13.0 too so it's been like that for a while.

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

go env Output
$ go1.15.6 env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\parent\AppData\Local\go-build
set GOENV=C:\Users\parent\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\parent\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\parent\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\parent\sdk\go1.15.6
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\parent\sdk\go1.15.6\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\parent\AppData\Local\Temp\go-build176809342=/tmp/go-build -gno-record-gcc-switches

What did you do?

git clone https://github.com/maruel/go-bench-recursive-bug
cd go-bench-recursive-bug
go1.15.6 test -bench=. ./...
go1.15.6 test -count=1 ./...

Tested https://github.com/maruel/go-bench-recursive-bug at commit maruel/go-bench-recursive-bug@4b4c223

The tree looks like:

  • go.mod
  • v1/
    • bench.go
    • bench_test.go
  • v2/
    • bench.go
    • bench_test.go

There is no .go file in the directory containing go.mod. The test files do not contain a benchmark.

See github action at https://github.com/maruel/go-bench-recursive-bug/blob/4b4c22328a366372765134a10c77900a48605d6a/.github/workflows/test.yml#L56. When shell is not set, it defaults to powershell on Windows. I reproduce locally so it is not github specific.

Here's an example test run to save you from testing locally: https://github.com/maruel/go-bench-recursive-bug/actions/runs/421285187

Ignore the ".\..." I was just experimenting.

What did you expect to see?

In macOS, linux, Windows 10 on cmd:

go1.15.6 test -bench=. ./...
PASS
ok      github.com/maruel/go-bench-recursive-bug/v1     0.309s
PASS
ok      github.com/maruel/go-bench-recursive-bug/v2     0.308s

go1.15.6 test -count=1 ./...
ok      github.com/maruel/go-bench-recursive-bug/v1     0.296s
ok      github.com/maruel/go-bench-recursive-bug/v2     0.568s

What did you see instead?

Windows 10 in powershell only:

go1.15.6 test -bench=. ./...
no Go files in C:\Users\parent\src\go-bench-recursive-bug

go1.15.6 test -count=1 ./...
ok      github.com/maruel/go-bench-recursive-bug/v1     0.310s
ok      github.com/maruel/go-bench-recursive-bug/v2     0.576s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ExpertNeededFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-WindowsWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions