Skip to content

x/playground: document how does it execute modules without errors about missing go.mod #73280

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

Closed
abitrolly opened this issue Apr 9, 2025 · 2 comments
Labels
Documentation Issues describing a change to documentation.
Milestone

Comments

@abitrolly
Copy link

Go version

1.24

Output of go env in your module/workspace:

N/A

What did you do?

I ran https://go.dev/play/p/0LmhkzGwVUc in playground without go.mod errors.

But running this code locally gives this,

$ go run exatxtar.go
exatxtar.go:6:2: no required module provides package golang.org/x/tools/txtar: go.mod file not found in current directory or any parent directory; see 'go help modules'

What did you see happen?

I see that playground is detecting and downloading imported modules even without go.mod.

go: finding module for package golang.org/x/tools/txtar
go: downloading golang.org/x/tools v0.32.0
go: found golang.org/x/tools/txtar in golang.org/x/tools v0.32.0
# play
./prog.go:10:31: cannot use "sdfdf" (untyped string constant) as byte value in array or slice literal
./prog.go:10:41: cannot use "" (untyped string constant) as []txtar.File value in struct literal

Go build failed.

What did you expect to see?

I expected to see some explanation of how playground does the automatic import. I would use the same feature for local development. But there are no docs. The only linked doc https://go.dev/blog/playground says "NOTE: This article does not describe the current version of the Go Playground." and have no mention of go.mod

Expected to find these strings in playground source code.

Expected Go repository browser to have search capability.

Expected the README to link to this tracker https://github.com/golang/go/issues?q=playground%20in%3Atitle

Related to #69403

@gopherbot gopherbot added this to the Unreleased milestone Apr 9, 2025
@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Apr 9, 2025
@gabyhelp
Copy link

gabyhelp commented Apr 9, 2025

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@seankhliao
Copy link
Member

I think it's out of scope. all it does is run go mod init for you.
And blog posts aren't expected to be updated all the time.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues describing a change to documentation.
Projects
None yet
Development

No branches or pull requests

4 participants