-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/playground: support txtar input files #32040
Comments
Change https://golang.org/cl/177043 mentions this issue: |
@bradfitz The current implementation of
Have you considered a behavior where the first file doesn't need to specify the
The txtar archive comment, if present, becomes Or, a more important/common situation if as I understand correctly that future shared snippets (that import third-party packages?) will have a go.mod file automatically appended:
The motivation is similar to how v1 of modules doesn't require a The advantage of the current requirement of first header is that it's more visible when txtar is used or not used. |
Oh, I see now that the code already does that. I missed that there's no return in the Edit: The function documentation was misleading; I'll leave a comment in code review. |
It even has tests! ;) |
I missed the test case because it wasn't in between the two other test cases where I expected to see it. I left a comment about that too. 😛 |
Updates golang/go#32040 Updates golang/go#31944 (Notably, you can now include a go.mod file) Change-Id: I56846e86d3d98fdf4cac388b5b284dbc187e3b36 Reviewed-on: https://go-review.googlesource.com/c/playground/+/177043 Reviewed-by: Dmitri Shuralyov <[email protected]>
Change https://golang.org/cl/177421 mentions this issue: |
Previously, handleFmt applied gofmt/goimports formatting to .go files only. This change makes it apply formatting to go.mod files as well. The cmd/go/internal/modfile package (well, a non-internal copy thereof) is used to perform the go.mod file formatting. Add test cases for error messages, and fix some cases where the paths weren't accurate. Detect when the error was returned by format.Source and needs to be prefixed by using the fixImports variable instead of checking for the presence of the prefix. This makes the code simpler and more readable. Replace old fs.m[f] usage with fs.Data(f) in fmt.go and txtar_test.go. Updates golang/go#32040 Updates golang/go#31944 Change-Id: Iefef7337f962914817558bcf0c622a952160ac44 Reviewed-on: https://go-review.googlesource.com/c/playground/+/177421 Reviewed-by: Brad Fitzpatrick <[email protected]>
It would be really cool if you could map the files into the sandbox so you could have data files in the set, allowing things like |
@ianthehat, I plan to add that, but doing it with the nacl backend would involve doing some wasted work, as I'd need to do the whole zip thing that we do for tests now with misc/nacl/mkzip.go and make some syscall changes to shove it in. I'd rather do it once we've moved the playground to linux/amd64, and then just write the files to "disk" (tmpfs) and access them directly. |
Multiple input files are supported (via txtar format) by now, so I'll close this. Adding a web UI to have separate <textarea> boxes seems to be better tracked in a new dedicated issue. /cc @toothrot |
(Pulling out of related third-party imports bug #31944)
This is a tracking bug to support multiple input files.
We'll start with txtar format, and use txtar behind the scenes when saving shared snippets. But we might add web UI to have separate
<textarea>
boxes later.The text was updated successfully, but these errors were encountered: