golang.org/x/playground@v0.0.0-20230418134305-14ebe15bcd59/README.md (about) 1 # playground 2 3 [](https://pkg.go.dev/golang.org/x/playground) 4 5 This subrepository holds the source for the Go playground: 6 https://go.dev/play/ 7 8 ## Building 9 10 ```bash 11 # build the image 12 docker build -t golang/playground . 13 ``` 14 15 ## Running 16 17 ```bash 18 docker run --name=play --rm -p 8080:8080 golang/playground & 19 # run some Go code 20 cat /path/to/code.go | go run client.go | curl -s --upload-file - localhost:8080/compile 21 ``` 22 23 To run the "gotip" version of the playground, set `GOTIP=true` 24 in your environment (via `-e GOTIP=true` if using `docker run`). 25 26 ## Deployment 27 28 ### Deployment Triggers 29 30 Playground releases automatically triggered when new Go repository tags are pushed to GitHub, or when master is pushed 31 on the playground repository. 32 33 For details, see [deploy/go_trigger.yaml](deploy/go_trigger.yaml), 34 [deploy/playground_trigger.yaml](deploy/playground_trigger.yaml), 35 and [deploy/deploy.json](deploy/deploy.json). 36 37 Changes to the trigger configuration can be made to the YAML files, or in the GCP UI, which should be kept in sync 38 using the `push-cloudbuild-triggers` and `pull-cloudbuild-triggers` make targets. 39 40 ### Deploy via Cloud Build 41 42 The Cloud Build configuration will always build and deploy with the latest supported release of Go. 43 44 ```bash 45 gcloud --project=golang-org builds submit --config deploy/deploy.json . 46 ``` 47 48 To deploy the "Go tip" version of the playground, which uses the latest 49 development build, use `deploy_gotip.json` instead: 50 51 ```bash 52 gcloud --project=golang-org builds submit --config deploy/deploy_gotip.json . 53 ``` 54 55 ### Deploy via gcloud app deploy 56 57 Building the playground Docker container takes more than the default 10 minute time limit of cloud build, so increase 58 its timeout first (note, `app/cloud_build_timeout` is a global configuration value): 59 60 ```bash 61 gcloud config set app/cloud_build_timeout 1200 # 20 mins 62 ``` 63 64 Alternatively, to avoid Cloud Build and build locally: 65 66 ```bash 67 make docker 68 docker tag golang/playground:latest gcr.io/golang-org/playground:latest 69 docker push gcr.io/golang-org/playground:latest 70 gcloud --project=golang-org --account=you@google.com app deploy app.yaml --image-url=gcr.io/golang-org/playground:latest 71 ``` 72 73 Then: 74 75 ```bash 76 gcloud --project=golang-org --account=you@google.com app deploy app.yaml 77 ``` 78 79 ## Contributing 80 81 To submit changes to this repository, see 82 https://golang.org/doc/contribute.html.