Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 playground/internal/imports/mkstdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func main() {
mustOpen(api("go1.5.txt")),
mustOpen(api("go1.6.txt")),
mustOpen(api("go1.7.txt")),
mustOpen(api("go1.8.txt")),
mustOpen("gopherjs.txt"),
)
sc := bufio.NewScanner(f)
Expand Down
472 changes: 279 additions & 193 deletions playground/internal/imports/zstdlib.go

Large diffs are not rendered by default.

Binary file modified playground/pkg/archive/tar.a.js
Binary file not shown.
Binary file modified playground/pkg/archive/zip.a.js
Binary file not shown.
Binary file modified playground/pkg/bufio.a.js
Binary file not shown.
Binary file modified playground/pkg/bytes.a.js
Binary file not shown.
Binary file modified playground/pkg/compress/bzip2.a.js
Binary file not shown.
Binary file modified playground/pkg/compress/flate.a.js
Binary file not shown.
Binary file modified playground/pkg/compress/gzip.a.js
Binary file not shown.
Binary file modified playground/pkg/compress/lzw.a.js
Binary file not shown.
Binary file modified playground/pkg/compress/zlib.a.js
Binary file not shown.
Binary file modified playground/pkg/container/heap.a.js
Binary file not shown.
Binary file modified playground/pkg/container/list.a.js
Binary file not shown.
Binary file modified playground/pkg/container/ring.a.js
Binary file not shown.
Binary file modified playground/pkg/context.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/aes.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/cipher.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/des.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/dsa.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/ecdsa.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/elliptic.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/hmac.a.js
Binary file not shown.
Binary file added playground/pkg/crypto/internal/cipherhw.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/md5.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/rand.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/rc4.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/rsa.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/sha1.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/sha256.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/sha512.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/subtle.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/tls.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/x509.a.js
Binary file not shown.
Binary file modified playground/pkg/crypto/x509/pkix.a.js
Binary file not shown.
Binary file modified playground/pkg/database/sql/driver.a.js
Binary file not shown.
Binary file modified playground/pkg/debug/dwarf.a.js
Binary file not shown.
Binary file modified playground/pkg/debug/gosym.a.js
Binary file not shown.
Binary file modified playground/pkg/debug/pe.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/ascii85.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/asn1.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/base32.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/base64.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/binary.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/csv.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/gob.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/hex.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/json.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/pem.a.js
Binary file not shown.
Binary file modified playground/pkg/encoding/xml.a.js
Binary file not shown.
Binary file modified playground/pkg/errors.a.js
Binary file not shown.
Binary file modified playground/pkg/flag.a.js
Binary file not shown.
Binary file modified playground/pkg/fmt.a.js
Binary file not shown.
Binary file modified playground/pkg/github.com/gopherjs/gopherjs/js.a.js
Binary file not shown.
Binary file modified playground/pkg/github.com/gopherjs/gopherjs/nosync.a.js
Binary file not shown.
Binary file modified playground/pkg/go/ast.a.js
Binary file not shown.
Binary file modified playground/pkg/go/doc.a.js
Binary file not shown.
Binary file modified playground/pkg/go/format.a.js
Binary file not shown.
Binary file modified playground/pkg/go/parser.a.js
Binary file not shown.
Binary file modified playground/pkg/go/printer.a.js
Binary file not shown.
Binary file modified playground/pkg/go/scanner.a.js
Binary file not shown.
Binary file modified playground/pkg/go/token.a.js
Binary file not shown.
Binary file modified playground/pkg/hash.a.js
Binary file not shown.
Binary file modified playground/pkg/hash/adler32.a.js
Binary file not shown.
Binary file modified playground/pkg/hash/crc32.a.js
Binary file not shown.
Binary file modified playground/pkg/hash/crc64.a.js
Binary file not shown.
Binary file modified playground/pkg/hash/fnv.a.js
Binary file not shown.
Binary file modified playground/pkg/html.a.js
Binary file not shown.
Binary file modified playground/pkg/html/template.a.js
Binary file not shown.
Binary file modified playground/pkg/image.a.js
Binary file not shown.
Binary file modified playground/pkg/image/color.a.js
Binary file not shown.
Binary file modified playground/pkg/image/color/palette.a.js
Binary file not shown.
Binary file modified playground/pkg/image/draw.a.js
Binary file not shown.
Binary file modified playground/pkg/image/gif.a.js
Binary file not shown.
Binary file modified playground/pkg/image/internal/imageutil.a.js
Binary file not shown.
Binary file modified playground/pkg/image/jpeg.a.js
Binary file not shown.
Binary file modified playground/pkg/image/png.a.js
Binary file not shown.
Binary file modified playground/pkg/index/suffixarray.a.js
Binary file not shown.
Binary file modified playground/pkg/internal/nettrace.a.js
Binary file not shown.
Binary file modified playground/pkg/internal/race.a.js
Binary file not shown.
Binary file modified playground/pkg/internal/singleflight.a.js
Binary file not shown.
Binary file modified playground/pkg/io.a.js
Binary file not shown.
Binary file modified playground/pkg/io/ioutil.a.js
Binary file not shown.
Binary file modified playground/pkg/log.a.js
Binary file not shown.
Binary file modified playground/pkg/math.a.js
Binary file not shown.
Binary file modified playground/pkg/math/big.a.js
Binary file not shown.
Binary file modified playground/pkg/math/cmplx.a.js
Binary file not shown.
Binary file modified playground/pkg/math/rand.a.js
Binary file not shown.
Binary file modified playground/pkg/mime.a.js
Binary file not shown.
Binary file modified playground/pkg/mime/multipart.a.js
Binary file not shown.
Binary file modified playground/pkg/mime/quotedprintable.a.js
Binary file not shown.
Binary file modified playground/pkg/net.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/cgi.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/cookiejar.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/fcgi.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/httptest.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/httptrace.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/httputil.a.js
Binary file not shown.
Binary file modified playground/pkg/net/http/internal.a.js
Binary file not shown.
Binary file modified playground/pkg/net/mail.a.js
Binary file not shown.
Binary file modified playground/pkg/net/smtp.a.js
Binary file not shown.
Binary file modified playground/pkg/net/textproto.a.js
Binary file not shown.
Binary file modified playground/pkg/net/url.a.js
Binary file not shown.
Binary file modified playground/pkg/os.a.js
Binary file not shown.
Binary file modified playground/pkg/os/exec.a.js
Binary file not shown.
Binary file modified playground/pkg/path.a.js
Binary file not shown.
Binary file modified playground/pkg/path/filepath.a.js
Binary file not shown.
Binary file modified playground/pkg/reflect.a.js
Binary file not shown.
Binary file modified playground/pkg/regexp.a.js
Binary file not shown.
Binary file modified playground/pkg/regexp/syntax.a.js
Binary file not shown.
Binary file modified playground/pkg/runtime.a.js
Binary file not shown.
Binary file modified playground/pkg/runtime/debug.a.js
Binary file not shown.
Binary file modified playground/pkg/runtime/internal/sys.a.js
Binary file not shown.
Binary file removed playground/pkg/runtime/pprof.a.js
Binary file not shown.
Binary file modified playground/pkg/runtime/trace.a.js
Binary file not shown.
Binary file modified playground/pkg/sort.a.js
Binary file not shown.
Binary file modified playground/pkg/strconv.a.js
Binary file not shown.
Binary file modified playground/pkg/strings.a.js
Binary file not shown.
Binary file modified playground/pkg/sync.a.js
Binary file not shown.
Binary file modified playground/pkg/sync/atomic.a.js
Binary file not shown.
Binary file modified playground/pkg/syscall.a.js
Binary file not shown.
Binary file modified playground/pkg/testing.a.js
Binary file not shown.
Binary file modified playground/pkg/testing/iotest.a.js
Binary file not shown.
Binary file modified playground/pkg/testing/quick.a.js
Binary file not shown.
Binary file modified playground/pkg/text/scanner.a.js
Binary file not shown.
Binary file modified playground/pkg/text/tabwriter.a.js
Binary file not shown.
Binary file modified playground/pkg/text/template.a.js
Binary file not shown.
Binary file modified playground/pkg/text/template/parse.a.js
Binary file not shown.
Binary file modified playground/pkg/time.a.js
Binary file not shown.
Binary file modified playground/pkg/unicode.a.js
Binary file not shown.
Binary file modified playground/pkg/unicode/utf16.a.js
Binary file not shown.
Binary file modified playground/pkg/unicode/utf8.a.js
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified playground/pkg/vendor/golang_org/x/net/http2/hpack.a.js
Binary file not shown.
Binary file added playground/pkg/vendor/golang_org/x/net/idna.a.js
Binary file not shown.
Binary file modified playground/pkg/vendor/golang_org/x/net/lex/httplex.a.js
Binary file not shown.
Binary file modified playground/pkg/vendor/golang_org/x/net/route.a.js
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
36 changes: 15 additions & 21 deletions playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,27 +206,21 @@ func main() {
}()

scope.Set("format", func() {
go func() {
code := []byte(scope.Get("code").String())
var out []byte
var err error
switch scope.Get("imports").Bool() {
case true:
out, err = imports.Process("prog.go", code, nil)
case false:
out, err = format.Source(code)
}
if err != nil {
scope.Apply(func() {
scope.Set("output", []Line{Line{"type": "err", "content": err.Error()}})
})
return
}
scope.Apply(func() {
scope.Set("code", string(out))
scope.Set("output", []Line{})
})
}()
code := []byte(scope.Get("code").String())
var out []byte
var err error
switch scope.Get("imports").Bool() {
case true:
out, err = imports.Process("prog.go", code, nil)
case false:
out, err = format.Source(code)
}
if err != nil {
scope.Set("output", []Line{Line{"type": "err", "content": err.Error()}})
return
}
scope.Set("code", string(out))
scope.Set("output", []Line{})
})

scope.Set("share", func() {
Expand Down
110 changes: 55 additions & 55 deletions playground/playground.js

Large diffs are not rendered by default.