Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/playground: support txtar input files #32040
(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
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.
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 <firstname.lastname@example.org>
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@example.com>
@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.