all: set CGO_ENABLED=0 when building snippets

GCC has never been available to our build step of the Playground.
Historically, the Playground always built programs with faketime, and
relied on patches for sandboxing in NaCL. In the future, we could enable
CGO programs to be built and run safely in the gVisor sandbox. In the
meantime, this fixes trivial snippets that rely on CGO parts of std.

Fixes golang/go#44714

Change-Id: If0e8b89f3c47bc080954dbd504d9de38295c16e2
Trust: Alexander Rakoczy <>
Run-TryBot: Alexander Rakoczy <>
TryBot-Result: Go Bot <>
Reviewed-by: Dmitri Shuralyov <>
2 files changed
tree: ca318c309d155567d9bf618aaeac2e1e836d3b60
  1. cmd/
  2. deploy/
  3. examples/
  4. internal/
  5. sandbox/
  6. static/
  7. .gitignore
  11. Dockerfile
  13. Makefile
  16. app.yaml
  17. cache.go
  18. client.go
  19. codereview.cfg
  20. edit.go
  21. edit.html
  22. enable-fake-time.patch
  23. fake_fs.lst
  24. fmt.go
  25. fmt_test.go
  26. go.mod
  27. go.sum
  28. logger.go
  29. main.go
  30. play.go
  31. play_test.go
  32. sandbox.go
  33. sandbox_test.go
  34. server.go
  35. server_test.go
  36. share.go
  37. store.go
  38. tests.go
  39. txtar.go
  40. txtar_test.go
  41. vet.go


Go Reference

This subrepository holds the source for the Go playground:


# build the image
docker build -t golang/playground .


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


Deployment Triggers

Playground releases automatically triggered when new Go repository tags are pushed to GitHub, or when master is pushed on the playground repository.

For details, see deploy/go_trigger.json, deploy/playground_trigger.json, and deploy/deploy.json.

After making changes to trigger configuration, update configuration by running the following Make target:

make update-cloudbuild-trigger

Deploy via Cloud Build

The Cloud Build configuration will always build and deploy with the latest supported release of Go.

gcloud builds submit --config deploy/deploy.json .

Deploy via gcloud app deploy

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 golang/playground:latest
docker push
gcloud --project=golang-org app deploy app.yaml


gcloud --project=golang-org app deploy app.yaml


To submit changes to this repository, see