playground: support multiple input files in txtar format

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 <dmitshur@golang.org>
11 files changed
tree: 0e5a702f79f28995f06103b681c89bdd81d13d8e
  1. AUTHORS
  2. CONTRIBUTING.md
  3. CONTRIBUTORS
  4. Dockerfile
  5. LICENSE
  6. Makefile
  7. PATENTS
  8. README.md
  9. app.yaml
  10. cache.go
  11. client.go
  12. codereview.cfg
  13. edit.go
  14. edit.html
  15. enable-fake-time.patch
  16. fake_fs.lst
  17. fmt.go
  18. fmt_test.go
  19. go.mod
  20. go.sum
  21. logger.go
  22. main.go
  23. play.go
  24. play_test.go
  25. sandbox.go
  26. server.go
  27. server_test.go
  28. share.go
  29. static/
  30. store.go
  31. tests.go
  32. txtar.go
  33. txtar_test.go
  34. vet.go
README.md

playground

This subrepository holds the source for the Go playground: https://play.golang.org/

Building

# build the image
docker build -t playground .

Running

docker run --name=play --rm -d -p 8080:8080 playground
# run some Go code
cat /path/to/code.go | go run client.go | curl -s --upload-file - localhost:8080/compile

Deployment

Building the playground Docker container takes more than the default 10 minute time limit of cloud build, so increase its timeout first (note, app/cloud_build_timeout is a global configuration value):

gcloud config set app/cloud_build_timeout 1200  # 20 mins

Alternatively, to avoid Cloud Build and build locally:

make docker
docker tag playground:latest gcr.io/golang-org/playground:latest
docker push gcr.io/golang-org/playground:latest
gcloud --project=golang-org --account=you@google.com app deploy app.yaml --image-url=gcr.io/golang-org/playground:latest

Then:

gcloud --project=golang-org --account=you@google.com app deploy app.yaml

Contributing

To submit changes to this repository, see https://golang.org/doc/contribute.html.