go icon indicating copy to clipboard operation
go copied to clipboard

x/playground: "// GOEXPERIMENT=loopvar“ line often causes "timeout running go build”

Open zigo101 opened this issue 2 years ago • 7 comments

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

$ go version
1.21

Does this issue reproduce with the latest release?

Yes

What did you do?

https://go.dev/play/p/VwcNVnozJlu

What did you expect to see?


Program exited.

What did you see instead?

timeout running go build

Go build failed.

zigo101 avatar Aug 13 '23 07:08 zigo101

Seeing this too. Does opting into the experiment need rebuilding parts of the stdlib, such as fmt?

thediveo avatar Aug 13 '23 14:08 thediveo

(attn @findleyr @golang/release)

bcmills avatar Aug 14 '23 18:08 bcmills

This is probably due to recompilation of std archives (which are cached following https://go.dev/cl/460635).

Perhaps we should add a special case and build archives with GOEXPERIMENT=loopvar here: (https://cs.opensource.google/go/x/playground/+/master:Dockerfile;l=90;drc=6821b5629810defb1ea68149e090b5b86576d7ca)

@bcmills can you confirm whether adding a second build of std would suffice? (I'm not familiar with GOEXPERIMENT handling in the Go command).

CC @rsc, who added support for GOEXPERIMENT in https://go.dev/cl/511640.

findleyr avatar Aug 14 '23 18:08 findleyr

can you confirm whether adding a second build of std would suffice? (I'm not familiar with GOEXPERIMENT handling in the Go command).

Yes, adding GOCACHE=/gocache GOEXPERIMENT=loopvar ./bin/go install --tags=faketime std should suffice.

That said, I question whether the benefit of doing so would be worth the cost, given the need to deploy and maintain it. I hope that the revised loop variable semantics will soon be available without setting GOEXPERIMENT at all. 🙃

bcmills avatar Aug 14 '23 19:08 bcmills

I hope that the revised loop variable semantics will soon be available without setting GOEXPERIMENT at all. 🙃

It is already available if you select "Go dev branch" on the playground (since https://github.com/golang/go/commit/fe1daf2e439ec1d650ea1193f10f52525f83f8a7)

fzipp avatar Aug 14 '23 19:08 fzipp

@fzipp that's a great point. In that case, I don't think we should bother making this work better for 1.21. It would increase the disk space required for every build, and as @bcmills noted would require maintenance.

findleyr avatar Aug 14 '23 19:08 findleyr

With 1.22 out, this seems to be even worse with GOEXPERIMENT=rangefunc. I'm getting timeouts 100% of the time now with this code.

DeedleFake avatar Feb 15 '24 16:02 DeedleFake