don't repl on js
This commit is contained in:
parent
1c9ab27b40
commit
71a89bd9a2
2 changed files with 6 additions and 0 deletions
|
@ -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.
|
// 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 {
|
func saveGobz(src interface{}, name string) error {
|
||||||
f, err := os.CreateTemp(".", name)
|
f, err := os.CreateTemp(".", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
5
main.go
5
main.go
|
@ -5,6 +5,7 @@ import (
|
||||||
_ "image/png"
|
_ "image/png"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"drjosh.dev/gurgle/engine"
|
"drjosh.dev/gurgle/engine"
|
||||||
|
@ -47,6 +48,10 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func repl(g *engine.Game) {
|
func repl(g *engine.Game) {
|
||||||
|
if runtime.GOOS == "js" {
|
||||||
|
// can't os.Stdin on js
|
||||||
|
return
|
||||||
|
}
|
||||||
sc := bufio.NewScanner(os.Stdin)
|
sc := bufio.NewScanner(os.Stdin)
|
||||||
for sc.Scan() {
|
for sc.Scan() {
|
||||||
tok := strings.Split(sc.Text(), " ")
|
tok := strings.Split(sc.Text(), " ")
|
||||||
|
|
Loading…
Reference in a new issue