1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:36:15 -07:00
go/cmd/present/play_socket.go
Andrew Gerrand ffb6076c75 playground: recognize managed vm's as being "on app engine"
Change-Id: I117b113e2782cab1180e6f56e1869525564ab18f
Reviewed-on: https://go-review.googlesource.com/14663
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 02:42:04 +00:00

37 lines
808 B
Go

// Copyright 2015 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.
// +build !appengine,!appenginevm
package main
import (
"net/http"
"net/url"
"runtime"
"golang.org/x/tools/playground/socket"
"golang.org/x/tools/present"
)
func initPlayground(basepath string, origin *url.URL) {
if present.PlayEnabled {
if *nativeClient {
socket.RunScripts = false
socket.Environ = func() []string {
if runtime.GOARCH == "amd64" {
return environ("GOOS=nacl", "GOARCH=amd64p32")
}
return environ("GOOS=nacl")
}
}
playScript(basepath, "SocketTransport")
http.Handle("/socket", socket.NewHandler(origin))
}
}
func playable(c present.Code) bool {
return present.PlayEnabled && c.Play
}