don't repl on js

This commit is contained in:
Josh Deprez 2021-08-25 16:54:22 +10:00
parent 1c9ab27b40
commit 71a89bd9a2
2 changed files with 6 additions and 0 deletions

View file

@ -40,6 +40,7 @@ func loadGobz(dst interface{}, assets fs.FS, path string) error {
}
// saveGobz takes an object, gob-encodes it, gzips it, and writes to disk.
// This requires running on something with a disk to write to (not JS)
func saveGobz(src interface{}, name string) error {
f, err := os.CreateTemp(".", name)
if err != nil {

View file

@ -5,6 +5,7 @@ import (
_ "image/png"
"log"
"os"
"runtime"
"strings"
"drjosh.dev/gurgle/engine"
@ -47,6 +48,10 @@ func main() {
}
func repl(g *engine.Game) {
if runtime.GOOS == "js" {
// can't os.Stdin on js
return
}
sc := bufio.NewScanner(os.Stdin)
for sc.Scan() {
tok := strings.Split(sc.Text(), " ")