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 1.23rc2, TestScript fails on Windows when GOEXPERIMENT is set: "go was invoked but no counters were incremented" #68579

Closed
dagood opened this issue Jul 24, 2024 · 8 comments
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Milestone

Comments

@dagood
Copy link
Contributor

dagood commented Jul 24, 2024

Go version

go version go1.23rc2 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\dagood\AppData\Local\go-build
set GOENV=C:\Users\dagood\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=aliastypeparams
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\dagood\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\dagood\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\git\golang-1.23
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=local
set GOTOOLDIR=C:\git\golang-1.23\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23rc2
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\dagood\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\git\golang-1.23\src\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\dagood\AppData\Local\Temp\go-build516846017=/tmp/go-build -gno-record-gcc-switches

What did you do?

In pwsh, in src:

$ .\make.bat
$ $env:GOEXPERIMENT='aliastypeparams'
$ ..\bin\go test cmd/go -run TestScript/mod_tidy_newroot

(Many other TestScripts will fail in this situation because they share the telemetry check, but I chose this one as an example with relatively low output.)

What did you see happen?

vcs-test.golang.org rerouted to http://127.0.0.1:56505
https://vcs-test.golang.org rerouted to https://127.0.0.1:56506
go test proxy running at GOPROXY=http://127.0.0.1:56507/mod
--- FAIL: TestScript (0.25s)
    --- FAIL: TestScript/mod_tidy_newroot (2.31s)
        script_test.go:135: 2024-07-24T21:21:42Z
        script_test.go:137: $WORK=C:\Users\dagood\AppData\Local\Temp\cmd-go-test-172627406\tmpdir3320471896\mod_tidy_newroot2053734181
        script_test.go:159:
            # https://golang.org/issue/45952: 'go mod tidy' in an eager module failed due
            # to an erroneous check on root completeness.
            #
            # Per the issue report:
            # > It may have to do with:
            # >
            # > package A imports package B in go.mod, which imports package C in its own go.mod
            # > package A drops direct dependency on package B …
            #
            # We infer from that that package C is still needed by some other indirect
            # dependency, and must be at a higher version than what is required by that
            # dependency (or else no new root would be needed). An additional package D
            # in its own module satisfies that condition, reproducing the bug. (2.269s)
        script_test.go:401: go was invoked but no counters were incremented
FAIL
FAIL    cmd/go  6.004s
FAIL

If I don't limit the test run, many other test scripts fail with the same error script_test.go:401: go was invoked but no counters were incremented.

I got the same bad result with $env:GOEXPERIMENT='arenas'.

What did you expect to see?

ok      cmd/go  6.191s

I got this result with go version devel go1.24-792a261303 Wed Jul 24 18:59:46 2024 +0000 windows/amd64 on the same machine.

@dagood
Copy link
Contributor Author

dagood commented Jul 24, 2024

If I delete VERSION, rerun make.bat, and then ..\bin\go test cmd/go -run TestScript/mod_tidy_newroot, the test passes.

@dmitshur
Copy link
Contributor

CC @matloob, @findleyr.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 25, 2024
@matloob
Copy link
Contributor

matloob commented Jul 25, 2024

I can reproduce on Windows (though not on macOS) so this might be a Windows-specific issue. I'll try to find a fix.

@matloob matloob self-assigned this Jul 25, 2024
@dagood
Copy link
Contributor Author

dagood commented Jul 25, 2024

It didn't happen for me on Linux either, I agree it's probably specific to running on Windows.

@matloob
Copy link
Contributor

matloob commented Aug 2, 2024

cc @findleyr

Running the test on windows it seems to be writing counters to a file called C:\Users\matloob\AppData\Local\Temp\cmd-go-test-2272649242\tmpdir1967189891\mod_tidy_newroot3105556267\telemetry\local\go@go1.23rc2 X:aliastypeparams-go1.23rc2 X:aliastypeparams-windows-amd64-2024-08-02.v1.count

We get the following error trying to open the file: The filename, directory name, or volume label syntax is incorrect.

I think that we expect that when the version name is not a devel version, say "go1.23rc2" that the version name doesn't contain anything other than the version name, but with GOEXPERIMENTS it adds the experiment names to the version. I think we should probably? mark those as devel.

@alexbrainman
Copy link
Member

to a file called C:\Users\matloob\AppData\Local\Temp\cmd-go-test-2272649242\tmpdir1967189891\mod_tidy_newroot3105556267\telemetry\local\go@go1.23rc2 X:aliastypeparams-go1.23rc2 X:aliastypeparams-windows-amd64-2024-08-02.v1.count

You should avoid using column ":" in the Windows file names. Just in case you did not know that.

Alex

@matloob
Copy link
Contributor

matloob commented Dec 16, 2024

This was fixed in x/telemetry by https://go.dev/cl/603855, which was vendored into cmd/ with https://go.dev/cl/603898

@matloob matloob closed this as completed Dec 16, 2024
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 16, 2024
@dmitshur dmitshur added this to the Go1.24 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Projects
None yet
Development

No branches or pull requests

5 participants