Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Update from upstream repo golang/playground@master #42

Open
wants to merge 146 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
0757b4e
playground: serve 404 for non-existent pages
dmitshur Aug 17, 2018
e07747d
playground: prevent caching memory-related runtime errors
katiehockman Aug 20, 2018
132c64f
Dockerfile: use latest x/tools containing the CL 113875
Oct 5, 2018
e11e51b
playground: use Go 1.11.1
dmitshur Oct 5, 2018
8cbc41a
playground: mention vet in about text
Oct 8, 2018
e03e829
playground: make outcome of "Run" clearer
Oct 11, 2018
ed387e6
Dockerfile: include updated x/tools containing CL 141477
Oct 16, 2018
ad3cdb9
playground: fix the test broken by CL 141478
Oct 23, 2018
cadbb20
Dockerfile: update golang.org/x/talks/... import path
dmitshur Oct 24, 2018
d134d7d
playground: prevent caching memory-related compile time errors
katiehockman Oct 23, 2018
22a2396
playground: remove stale TODO about exit code
Nov 1, 2018
e08a6e0
playground: update snippet to tell version
dmitshur Nov 13, 2018
381a079
playground: use Go 1.12
dmitshur Feb 26, 2019
15cfee7
playground: update dependencies
dmitshur Feb 26, 2019
be0fe03
playground: put GOCACHE in temp dir
bradfitz Feb 28, 2019
b884d85
README: document the need to increase cloud build timeout
dmitshur Feb 28, 2019
33ccd9b
Dockerfile: update from jessie to stretch
bradfitz May 9, 2019
046e863
playground: support third-party imports (off by default for now)
bradfitz May 9, 2019
1cc919a
playground: let clients request vet check in same HTTP request as com…
bradfitz May 10, 2019
1b5b098
playground: enable third-party imports
bradfitz May 13, 2019
a7b4d4c
playground: support multiple input files in txtar format
bradfitz May 14, 2019
e1479bc
playground: format go.mod files; fix paths in formatting errors
dmitshur May 15, 2019
742871f
Makefile: adjust the test rule to be more useful
bradfitz May 15, 2019
c4ae04c
playground: parameterize GO_VERSION in Dockerfile
toothrot Jun 13, 2019
78fe024
playground: trigger playground releases from Go releases
toothrot Jun 19, 2019
607f1df
playground: build playground Go from source
toothrot Jun 21, 2019
18ef8a7
playground: push image in trigger before deploying
toothrot Jul 9, 2019
01ce4a0
playground: trigger playground deploys from master
toothrot Jul 9, 2019
5fdf601
playground: simplify latest go version logic
toothrot Jul 9, 2019
509e10f
playground: allow explicit GOPROXY variable
Jul 1, 2019
ee0783d
playground: set GOPROXY when building Docker image
andybons Jul 30, 2019
a712dec
Dockerfile: update Go version to 1.13
andybons Sep 2, 2019
394f19f
playground: differentiate cache key based on client JS version
bradfitz May 16, 2019
bd57f61
playground: bound compilation time too
bradfitz Sep 10, 2019
a46a9c2
playground: use txtar and modfile from golang.org/x
bradfitz Nov 19, 2019
4d36241
sandbox: add gvisor runsc-based sandbox
bradfitz Sep 17, 2019
a0e4bb3
sandbox: add missing word to package doc
bradfitz Jan 8, 2020
33fdd75
playground: run in golang VPC network
bradfitz Jan 9, 2020
62f81bd
sandbox: test docker connection & pull image before starting workers
bradfitz Jan 9, 2020
0eefa27
sandbox: create larger VMs, add instance tags to permits health checks
bradfitz Jan 14, 2020
2f45547
sandbox: add logging-write scope to service account
toothrot Jan 14, 2020
bca227f
sandbox: add header to stderr output, to skip anything that comes bef…
bradfitz Jan 14, 2020
8445a09
playground: slurp binary to memory in gvisor mode
bradfitz Jan 16, 2020
1e9c260
sandbox, internal/gcpdial: dial sandbox backends directly, add health…
bradfitz Jan 24, 2020
3f031d7
playground: warm up backend dialer at start
bradfitz Jan 28, 2020
09dfaa1
playground: add examples to demonstrate tricks
smasher164 Jan 27, 2020
fa32453
playground: enable CORS on /fmt and /p/ routes
mo4islona Sep 8, 2019
5682330
playground: fix the build for Go 1.14.x
toothrot Apr 3, 2020
dda036d
playground: upgrade to Debian Buster
toothrot Apr 3, 2020
9d1e738
playground: fix the build for gVisor
toothrot Apr 3, 2020
0bc4181
playground: correct ARG scoping in Dockerfile
toothrot Apr 8, 2020
15e9685
playground: enable gVisor in production
toothrot Apr 8, 2020
cb3741f
playground: use the correct contexts for sandbox requests
toothrot Apr 3, 2020
27e208b
playground: drop NaCL support
toothrot Mar 31, 2020
688d9f6
playground: move build and run into functions
toothrot Apr 6, 2020
8e01013
playground: isolate playground build stage in Docker
toothrot Apr 14, 2020
0a10c62
internal/gcpdial: throttle polling for instances
toothrot Apr 8, 2020
136c41e
sandbox: timeout runsc commands
toothrot Apr 8, 2020
b92c87d
playground: make isTest match its documentation
Apr 16, 2020
ede79dd
playground: update x/mod and x/tools
smasher164 Apr 20, 2020
0084f7f
playground: show a meaningful error on build timeout
toothrot Apr 15, 2020
11cd822
playground: stop storing timeouts in cache
toothrot Apr 21, 2020
b8c0e2b
playground: only build binaries for health check
toothrot Apr 23, 2020
8da5bd6
sandbox: update configuration to match production
toothrot Apr 22, 2020
a90f64a
sandbox: change from n1 to e2 instances
toothrot Apr 24, 2020
91bfd78
sandbox: add stackdriver scope
toothrot Apr 23, 2020
7bdfbfb
sandbox: instrument HTTP handlers with StackDriver
toothrot Apr 23, 2020
ccdf1e5
sandbox: instrument number of running containers
toothrot Apr 23, 2020
26d50f8
sandbox: correct stackdriver labels
toothrot Apr 24, 2020
66a9e4b
sandbox: add container creation metrics
toothrot Apr 25, 2020
560694f
playground: use flexbox for navbar layout
smasher164 Apr 22, 2020
195e12f
sandbox: reduce container starvation
toothrot Apr 25, 2020
0298bc8
sandbox: fix missing timezone data
toothrot Apr 29, 2020
352556d
playground: fix image tag in README
johnmccabe Jul 21, 2020
48a1655
README.md: add badge to pkg.go.dev
julieqiu Dec 3, 2020
9040051
all: go fmt ./...
rsc Feb 19, 2021
9028cb5
all: support Go 1.16 in the Go Playground
toothrot Feb 22, 2021
4d02eef
sandbox: always use latest runsc version
toothrot Feb 23, 2021
94eacb7
all: test with the latest released Go version
toothrot Mar 1, 2021
6cd0363
all: set CGO_ENABLED=0 when building snippets
toothrot Mar 1, 2021
d1c0810
internal/metrics: add new package for recording metrics
toothrot Mar 17, 2021
3398ffb
all: instrument build, vet, and run time
toothrot Mar 17, 2021
0a69b5b
internal/metrics: fix detection of GCE environment
toothrot Mar 19, 2021
9814fb9
all: increase compile timeout to 10 seconds
toothrot Mar 17, 2021
541c3c3
deploy: use gcloud to manage triggers, trigger from GCR
heschi Jun 11, 2021
d790a2e
all: fix build timeouts for std dependent snippets
toothrot Jul 23, 2021
69dad2b
examples: add an HTTP server example
FiloSottile Jun 17, 2021
d55b12a
playground: fix vertical alignment of "Imports" checkbox
smasher164 Feb 22, 2021
f8a58a0
deploy: add deployment configuration for a gotip playground instance
findleyr Nov 10, 2021
9bfb5bd
app engine: copy app engine configuration to app.yaml and app.gotip.yaml
findleyr Nov 10, 2021
6987932
gotipplay: identify the gotip playground build in the UI
findleyr Nov 15, 2021
8bb1e2e
examples: derive examples from the examples directory
findleyr Nov 16, 2021
0750b08
playground: redirect https://play.golang.org/ to https://go.dev/play
rsc Nov 18, 2021
11560ec
go2go: add an app engine service to redirect go2goplay to gotipplay
findleyr Nov 17, 2021
5e565e5
gotipplay: fix GOTIP environment variable to be string
findleyr Nov 22, 2021
9187f21
deploy: update build and deploy timeout to 3600s
toothrot Nov 22, 2021
f648226
deploy: add daily schedule for gotip playground
toothrot Nov 23, 2021
69a7421
playground: add a goprevplay service, hosting the previous go release
findleyr Nov 30, 2021
04e7b2a
playground: fix service name for app.goprev.yaml
findleyr Nov 30, 2021
ec0fe01
playground: fix docker image of of goprevplay
findleyr Nov 30, 2021
feeb797
deploy: tag the correct image for playground-goprev
findleyr Dec 1, 2021
6c55170
playground: clean up environment for goprevplay
findleyr Dec 1, 2021
5ac9766
playground: add a version endpoint
findleyr Nov 19, 2021
ddc36c7
deploy: use more powerful instance for deploy
rsc Jan 5, 2022
28ff678
internal: fix typo
cuishuang Mar 7, 2022
6aeb6d3
all: remove grpc.go4.org dependency
toothrot Mar 17, 2022
60559de
deploy: add triggers for the goprev playground
findleyr Mar 23, 2022
0e519ec
deploy: prune app engine versions during build
jamalc Apr 5, 2022
ea37068
all: gofmt
rsc Apr 11, 2022
ac3e19c
A+C: delete AUTHORS and CONTRIBUTORS
rsc Jul 22, 2022
864e808
all: replace io/ioutil with io and os package
cuishuang Sep 13, 2022
5931d39
internal/metrics: fix leaking stackdriver exporter
odeke-em Oct 13, 2022
972afd6
playground: copy a build cache containing std archives on each build
findleyr Jan 5, 2023
7d703e8
playground: 4x resources for the tip playground
findleyr Jan 12, 2023
2926764
x/playground: allow playground to run fuzz tests
nikola-jokic Dec 8, 2022
4eec63b
sandbox: remove terraform config
rolandshoemaker Feb 6, 2023
f9826ed
all: update golang.org/x/ dependencies
findleyr Mar 24, 2023
6d06603
cmd/latestgo: Use Gerrit to retrieve latest Go version
pgeorgas Feb 14, 2023
3300b16
cmd/latestgo: restore the -prev flag
findleyr Mar 29, 2023
27f5283
deploy: fail the goprev deployment if latestgo fails
findleyr Mar 29, 2023
14ebe15
sandbox: fix typo
lnnt Apr 17, 2023
6c88a43
playground: recognize // GOEXPERIMENT=foo lines at top of source file
rsc Jul 23, 2023
b6fff79
all: upgrade x/build to fix cmd/latestgo
findleyr Aug 8, 2023
6821b56
Dockerfile: update the bootstrap version to go1.20
findleyr Aug 8, 2023
27dbd02
all: update go directive to 1.18
dmitshur Oct 11, 2023
090502f
sandbox.go: fix comment
cuishuang Feb 7, 2023
af6601c
play.go: remove repetitive word
cuishuang Aug 9, 2023
8d67851
deploy: prune old App Engine versions for 2 more playgrounds
dmitshur Jan 13, 2024
46e2687
share: hard-code an allow list of IP prefixes for proxied traffic
findleyr Jan 16, 2024
7729272
share: use forwarded IP for geoIP prefix allow list comparison
findleyr Jan 16, 2024
baeddcd
share: remove the allowShare guard
findleyr Jan 17, 2024
731d161
x/playground: remove -mod=mod and execute go mod tidy before command
nikola-jokic Dec 21, 2022
f4dce0b
Revert "x/playground: remove -mod=mod and execute go mod tidy before …
findleyr Feb 2, 2024
ab8d13a
go.mod: update golang.org/x/mod dependency
dmitshur Feb 23, 2024
06f6438
LICENSE: update per Google Legal
rsc Jul 16, 2024
df5b938
x/playground: support multifile code with tests
nikola-jokic Jan 19, 2023
521016c
TestIsTest: move ill-formed tests into a testdata subpackage
adonovan Aug 22, 2024
33740e3
all: update Go versions in Dockerfiles
findleyr Sep 3, 2024
a92027e
go.mod: update golang.org/x dependencies
gopherbot Sep 9, 2024
b6b44f6
all: use the previous major Go release to bootstrap the build
findleyr Sep 4, 2024
e948647
deploy: fix incorrect argument in deploy_goprev.json
findleyr Sep 11, 2024
1d4d269
sandbox: pass experiments to vet
findleyr Sep 11, 2024
791ab41
go.mod: update golang.org/x dependencies
gopherbot Oct 4, 2024
b161c0c
Dockerfile: fix typos
dbut2 Oct 9, 2024
aaee5e5
README: mention the git repo
ianlancetaylor Nov 5, 2024
f0a08e7
go.mod: update golang.org/x dependencies
gopherbot Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.terraform
3 changes: 0 additions & 3 deletions AUTHORS

This file was deleted.

3 changes: 0 additions & 3 deletions CONTRIBUTORS

This file was deleted.

284 changes: 93 additions & 191 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,213 +1,115 @@
# Copyright 2017 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
FROM debian:jessie as builder
LABEL maintainer "[email protected]"

ENV GOPATH /go
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
ENV GOROOT_BOOTSTRAP /usr/local/gobootstrap
ENV CGO_ENABLED=0
ENV GO_VERSION 1.10.3
ENV BUILD_DEPS 'curl bzip2 git gcc patch libc6-dev ca-certificates'

# Fake time
COPY enable-fake-time.patch /usr/local/playground/
COPY strict-time.patch /usr/local/playground/
# Fake file system
COPY fake_fs.lst /usr/local/playground/

# The playground builds Go from a bootstrap version for two reasons:
# - The playground deployment is triggered before the artifacts are
# published for the latest version of Go.
# - The sandbox builds the Go standard library with a custom build
# flag called faketime.

# GO_VERSION is provided by Cloud Build, and is set to the latest
# version of Go. See the configuration in the deploy directory.
ARG GO_VERSION=go1.22.6

# GO_BOOTSTRAP_VERSION is downloaded below and used to bootstrap the build from
# source. Therefore, this should be a version that is guaranteed to have
# published artifacts, such as the latest minor of the previous major Go
# release.
#
# See also https://go.dev/issue/69238.
ARG GO_BOOTSTRAP_VERSION=go1.22.6

############################################################################
# Build Go at GO_VERSION, and build faketime standard library.
FROM debian:buster AS build-go
LABEL maintainer="[email protected]"

ENV BUILD_DEPS 'curl git gcc patch libc6-dev ca-certificates'
RUN apt-get update && apt-get install -y ${BUILD_DEPS} --no-install-recommends

RUN curl -s https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.544461/naclsdk_linux.tar.bz2 | tar -xj -C /tmp --strip-components=2 pepper_67/tools/sel_ldr_x86_64

# Get the Go binary.
RUN curl -sSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz
RUN curl -sSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz.sha256 -o /tmp/go.tar.gz.sha256
ENV GOPATH /go
ENV GOROOT_BOOTSTRAP=/usr/local/go-bootstrap

# https://docs.docker.com/reference/dockerfile/#understand-how-arg-and-from-interact
ARG GO_VERSION
ENV GO_VERSION ${GO_VERSION}
ARG GO_BOOTSTRAP_VERSION
ENV GO_BOOTSTRAP_VERSION ${GO_BOOTSTRAP_VERSION}

# Get a bootstrap version of Go for building GO_VERSION. At the time
# of this Dockerfile being built, GO_VERSION's artifacts may not yet
# be published.
RUN curl -sSL https://dl.google.com/go/$GO_BOOTSTRAP_VERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz
RUN curl -sSL https://dl.google.com/go/$GO_BOOTSTRAP_VERSION.linux-amd64.tar.gz.sha256 -o /tmp/go.tar.gz.sha256
RUN echo "$(cat /tmp/go.tar.gz.sha256) /tmp/go.tar.gz" | sha256sum -c -
RUN tar -C /usr/local/ -vxzf /tmp/go.tar.gz
# Make a copy for GOROOT_BOOTSTRAP, because we rebuild the toolchain and make.bash removes bin/go as its first step.
RUN cp -R /usr/local/go $GOROOT_BOOTSTRAP
# Apply the fake time and fake filesystem patches.
RUN patch /usr/local/go/src/runtime/rt0_nacl_amd64p32.s /usr/local/playground/enable-fake-time.patch
RUN patch -p1 -d /usr/local/go </usr/local/playground/strict-time.patch
RUN cd /usr/local/go && go run misc/nacl/mkzip.go -p syscall /usr/local/playground/fake_fs.lst src/syscall/fstest_nacl.go
# Re-build the Go toolchain.
RUN cd /usr/local/go/src && GOOS=nacl GOARCH=amd64p32 ./make.bash --no-clean

# BEGIN deps (run `make update-deps` to update)

# Repo cloud.google.com/go at 3afaae4 (2018-03-02)
ENV REV=3afaae429987a1884530d6018d6e963a932d28c0
RUN go get -d cloud.google.com/go/compute/metadata `#and 6 other pkgs` &&\
(cd /go/src/cloud.google.com/go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo github.com/bradfitz/gomemcache at 1952afa (2017-02-08)
ENV REV=1952afaa557dc08e8e0d89eafab110fb501c1a2b
RUN go get -d github.com/bradfitz/gomemcache/memcache &&\
(cd /go/src/github.com/bradfitz/gomemcache && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo github.com/golang/protobuf at bbd03ef (2018-02-02)
ENV REV=bbd03ef6da3a115852eaf24c8a1c46aeb39aa175
RUN go get -d github.com/golang/protobuf/proto `#and 8 other pkgs` &&\
(cd /go/src/github.com/golang/protobuf && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo github.com/googleapis/gax-go at 317e000 (2017-09-15)
ENV REV=317e0006254c44a0ac427cc52a0e083ff0b9622f
RUN go get -d github.com/googleapis/gax-go &&\
(cd /go/src/github.com/googleapis/gax-go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo golang.org/x/net at ae89d30 (2018-03-11)
ENV REV=ae89d30ce0c63142b652837da33d782e2b0a9b25
RUN go get -d golang.org/x/net/context `#and 8 other pkgs` &&\
(cd /go/src/golang.org/x/net && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo golang.org/x/oauth2 at 2f32c3a (2018-02-28)
ENV REV=2f32c3ac0fa4fb807a0fcefb0b6f2468a0d99bd0
RUN go get -d golang.org/x/oauth2 `#and 5 other pkgs` &&\
(cd /go/src/golang.org/x/oauth2 && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo golang.org/x/text at b7ef84a (2018-03-02)
ENV REV=b7ef84aaf62aa3e70962625c80a571ae7c17cb40
RUN go get -d golang.org/x/text/secure/bidirule `#and 4 other pkgs` &&\
(cd /go/src/golang.org/x/text && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo golang.org/x/tools at 48418e5 (2018-05-08)
ENV REV=48418e5732e1b1e2a10207c8007a5f959e422f20
RUN go get -d golang.org/x/tools/go/ast/astutil `#and 3 other pkgs` &&\
(cd /go/src/golang.org/x/tools && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo google.golang.org/api at ab90adb (2018-02-22)
ENV REV=ab90adb3efa287b869ecb698db42f923cc734972
RUN go get -d google.golang.org/api/googleapi `#and 6 other pkgs` &&\
(cd /go/src/google.golang.org/api && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo google.golang.org/genproto at 2c5e7ac (2018-03-02)
ENV REV=2c5e7ac708aaa719366570dd82bda44541ca2a63
RUN go get -d google.golang.org/genproto/googleapis/api/annotations `#and 4 other pkgs` &&\
(cd /go/src/google.golang.org/genproto && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Repo google.golang.org/grpc at f0a1202 (2018-02-28)
ENV REV=f0a1202acdc5c4702be05098d5ff8e9b3b444442
RUN go get -d google.golang.org/grpc `#and 24 other pkgs` &&\
(cd /go/src/google.golang.org/grpc && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

# Optimization to speed up iterative development, not necessary for correctness:
RUN go install cloud.google.com/go/compute/metadata \
cloud.google.com/go/datastore \
cloud.google.com/go/internal \
cloud.google.com/go/internal/atomiccache \
cloud.google.com/go/internal/fields \
cloud.google.com/go/internal/version \
github.com/bradfitz/gomemcache/memcache \
github.com/golang/protobuf/proto \
github.com/golang/protobuf/protoc-gen-go/descriptor \
github.com/golang/protobuf/ptypes \
github.com/golang/protobuf/ptypes/any \
github.com/golang/protobuf/ptypes/duration \
github.com/golang/protobuf/ptypes/struct \
github.com/golang/protobuf/ptypes/timestamp \
github.com/golang/protobuf/ptypes/wrappers \
github.com/googleapis/gax-go \
golang.org/x/net/context \
golang.org/x/net/context/ctxhttp \
golang.org/x/net/http2 \
golang.org/x/net/http2/hpack \
golang.org/x/net/idna \
golang.org/x/net/internal/timeseries \
golang.org/x/net/lex/httplex \
golang.org/x/net/trace \
golang.org/x/oauth2 \
golang.org/x/oauth2/google \
golang.org/x/oauth2/internal \
golang.org/x/oauth2/jws \
golang.org/x/oauth2/jwt \
golang.org/x/text/secure/bidirule \
golang.org/x/text/transform \
golang.org/x/text/unicode/bidi \
golang.org/x/text/unicode/norm \
golang.org/x/tools/go/ast/astutil \
golang.org/x/tools/godoc/static \
golang.org/x/tools/imports \
google.golang.org/api/googleapi \
google.golang.org/api/googleapi/internal/uritemplates \
google.golang.org/api/internal \
google.golang.org/api/iterator \
google.golang.org/api/option \
google.golang.org/api/transport/grpc \
google.golang.org/genproto/googleapis/api/annotations \
google.golang.org/genproto/googleapis/datastore/v1 \
google.golang.org/genproto/googleapis/rpc/status \
google.golang.org/genproto/googleapis/type/latlng \
google.golang.org/grpc \
google.golang.org/grpc/balancer \
google.golang.org/grpc/balancer/base \
google.golang.org/grpc/balancer/roundrobin \
google.golang.org/grpc/codes \
google.golang.org/grpc/connectivity \
google.golang.org/grpc/credentials \
google.golang.org/grpc/credentials/oauth \
google.golang.org/grpc/encoding \
google.golang.org/grpc/encoding/proto \
google.golang.org/grpc/grpclb/grpc_lb_v1/messages \
google.golang.org/grpc/grpclog \
google.golang.org/grpc/internal \
google.golang.org/grpc/keepalive \
google.golang.org/grpc/metadata \
google.golang.org/grpc/naming \
google.golang.org/grpc/peer \
google.golang.org/grpc/resolver \
google.golang.org/grpc/resolver/dns \
google.golang.org/grpc/resolver/passthrough \
google.golang.org/grpc/stats \
google.golang.org/grpc/status \
google.golang.org/grpc/tap \
google.golang.org/grpc/transport
# END deps

# Add and compile playground daemon
RUN mkdir -p $GOROOT_BOOTSTRAP
RUN tar --strip=1 -C $GOROOT_BOOTSTRAP -vxzf /tmp/go.tar.gz

RUN mkdir /gocache
ENV GOCACHE /gocache
ENV GO111MODULE on
ENV GOPROXY=https://proxy.golang.org

# Compile Go at target version in /usr/local/go.
WORKDIR /usr/local
RUN git clone https://go.googlesource.com/go go && cd go && git reset --hard $GO_VERSION
WORKDIR /usr/local/go/src
RUN ./make.bash

############################################################################
# Build playground web server.
FROM debian:buster AS build-playground

RUN apt-get update && apt-get install -y ca-certificates git --no-install-recommends
# Build playground from Go built at GO_VERSION.
COPY --from=build-go /usr/local/go /usr/local/go
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH="/go/bin:/usr/local/go/bin:${PATH}"
# Cache dependencies for efficient Dockerfile building.
COPY go.mod /go/src/playground/go.mod
COPY go.sum /go/src/playground/go.sum
WORKDIR /go/src/playground
RUN go mod download

# Add and compile playground daemon.
COPY . /go/src/playground/
RUN go install playground
RUN go install

FROM debian:jessie
############################################################################
# Final stage.
FROM debian:buster

RUN apt-get update && apt-get install -y git ca-certificates --no-install-recommends

COPY --from=builder /usr/local/go /usr/local/go
COPY --from=builder /tmp/sel_ldr_x86_64 /usr/local/bin
# Make a copy in /usr/local/go-faketime where the standard library
# is installed with -tags=faketime.
COPY --from=build-go /usr/local/go /usr/local/go-faketime

ENV CGO_ENABLED 0
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH

# Add and compile tour packages
RUN GOOS=nacl GOARCH=amd64p32 go get \
golang.org/x/tour/pic \
golang.org/x/tour/reader \
golang.org/x/tour/tree \
golang.org/x/tour/wc \
golang.org/x/talks/2016/applicative/google && \
rm -rf $GOPATH/src/golang.org/x/tour/.git && \
rm -rf $GOPATH/src/golang.org/x/talks/.git

# Add tour packages under their old import paths (so old snippets still work)
RUN mkdir -p $GOPATH/src/code.google.com/p/go-tour && \
cp -R $GOPATH/src/golang.org/x/tour/* $GOPATH/src/code.google.com/p/go-tour/ && \
sed -i 's_// import_// public import_' $(find $GOPATH/src/code.google.com/p/go-tour/ -name *.go) && \
go install \
code.google.com/p/go-tour/pic \
code.google.com/p/go-tour/reader \
code.google.com/p/go-tour/tree \
code.google.com/p/go-tour/wc
ENV GOROOT /usr/local/go-faketime
ARG GO_VERSION
ENV GO_VERSION ${GO_VERSION}
ENV PATH="/go/bin:/usr/local/go-faketime/bin:${PATH}"

WORKDIR /usr/local/go-faketime
# golang/go#57495: install std to warm the build cache. We only set
# GOCACHE=/gocache here to keep it as small as possible, since it must be
# copied on every build.
RUN GOCACHE=/gocache ./bin/go install --tags=faketime std
# Ignore the exit code. go vet std does not pass vet with the faketime
# patches, but it successfully caches results for when we vet user
# snippets.
RUN ./bin/go vet --tags=faketime std || true

RUN mkdir /app

COPY --from=builder /go/bin/playground /app
COPY --from=build-playground /go/bin/playground /app
COPY edit.html /app
COPY static /app/static
COPY examples /app/examples
WORKDIR /app

# Run tests
RUN /app/playground test

EXPOSE 8080
ENTRYPOINT ["/app/playground"]
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 The Go Authors. All rights reserved.
Copyright 2014 The Go Authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand All @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

Expand Down
55 changes: 46 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
.PHONY: update-deps docker test
LATEST_GO := $(shell go run ./cmd/latestgo)

update-deps:
go install golang.org/x/build/cmd/gitlock
gitlock --update=Dockerfile golang.org/x/playground
.PHONY: docker test update-cloudbuild-trigger

docker: Dockerfile
docker build -t playground .
docker:
docker build --build-arg GO_VERSION=$(LATEST_GO) -t golang/playground .

test: docker
go test
docker run --rm playground test
runlocal:
docker network create sandnet || true
docker kill play_dev || true
docker run --name=play_dev --rm --network=sandnet -ti -p 127.0.0.1:8081:8080/tcp golang/playground --backend-url="http://sandbox_dev.sandnet/run"

test_go:
# Run fast tests first: (and tests whether, say, things compile)
GO111MODULE=on go test -v ./...

test_gvisor: docker
docker kill sandbox_front_test || true
docker run --rm --name=sandbox_front_test --network=sandnet -t golang/playground --runtests

# Note: test_gvisor is not included in "test" yet, because it requires
# running a separate server first ("make runlocal" in the sandbox
# directory)
test: test_go

define GOTIP_MESSAGE
Note: deploy/gotip_schedule.yaml must be manually managed with gcloud.
Example:
gcloud scheduler jobs update http \
projects/golang-org/locations/us-central1/jobs/playground-deploy-gotip-playground-schedule \
--schedule="0 10 * * *" --time-zone="America/New_York"
endef
export GOTIP_MESSAGE

push-cloudbuild-triggers:
gcloud beta builds triggers import --project golang-org --source deploy/go_trigger.yaml
gcloud beta builds triggers import --project golang-org --source deploy/go_goprev_trigger.yaml
gcloud beta builds triggers import --project golang-org --source deploy/playground_trigger.yaml
gcloud beta builds triggers import --project golang-org --source deploy/playground_goprev_trigger.yaml
gcloud alpha builds triggers import --project golang-org --source deploy/gotip_scheduled_trigger.yaml
@echo "$$GOTIP_MESSAGE"

pull-cloudbuild-triggers:
gcloud beta builds triggers export --project golang-org playground-redeploy-go-release --destination deploy/go_trigger.yaml
gcloud beta builds triggers export --project golang-org playground-redeploy-goprev-go-release --destination deploy/go_goprev_trigger.yaml
gcloud beta builds triggers export --project golang-org playground-redeploy-playground --destination deploy/playground_trigger.yaml
gcloud beta builds triggers export --project golang-org playground-redeploy-goprev-playground --destination deploy/playground_goprev_trigger.yaml
gcloud alpha builds triggers export --project golang-org playground-deploy-gotip-playground --destination deploy/gotip_scheduled_trigger.yaml
gcloud scheduler --project=golang-org jobs describe --format=yaml playground-deploy-gotip-playground-schedule > deploy/gotip_schedule.yaml
Loading