Re:Show HN: Go playground powered by WASM that runs in the b...
by gizdan on Friday September 24, 2021 @12:45AM
(#28638715)
Off-topic: I know one of you smart folks here at HN have figured out how to do something similar to go playground in the terminal that makes it easy to write a script, and on safe it go fmt's + imports, and then runs it. Something with vim + tmux or whatever. If this is you, I'd love it if you could share it!
[ Parent
| on HN ]
Re:Show HN: Go playground powered by WASM that runs in the b...
by stonewareslord on Friday September 24, 2021 @01:37AM
(#28638971)
I use a script for this. Something like:
#!/usr/bin/env bash
{
find . -name "*.go" -print
echo package.json
} | entr bash -c '
set -euxo pipefail
clear
go fmt
clear
go build
:
'
You can make it fancier like adding cd into "${BASH_SOURCE[0]%/*}", etc
Re:Show HN: Go playground powered by WASM that runs in the b...
by gobookdev on Friday September 24, 2021 @05:11AM
(#28640155)
I made this extension for VS Code that also saves the outputs to markdown, so you can save it straight to blog posts: https://marketplace.visualstudio.com/items?itemName=gobookde...
Each cell runs in a 0.3 secs on Linux, but 3 seconds + on Windows.
If you want just straight terminal check out Gomacro, that's a interpreter that runs really fast, didn't find any differences to compiled Go.
Re:Show HN: Go playground powered by WASM that runs in the b...
by chakkepolja on Friday September 24, 2021 @03:23AM
(#28639524)
There's an REPL called yaegi, but it's pretty primitive (no autocompletion etc.. when I tried).
There seems to be another interpreter that seems to be able to provide some autocomplete using some other third party tool, but it seemed to run from beginning every time (same effect as `go run`) and I havent tried it.
Re:Show HN: Go playground powered by WASM that runs in the b...
by gizdan on Friday September 24, 2021 @06:27AM
(#28640607)
The issue with these REPLs is for whatever reason it doesn't come close to the experience of say the python REPL. I have been hoping for the Go devs to build a REPL into the tooling but so far nothing has happened yet.
Re:Show HN: Go playground powered by WASM that runs in the b...
by chakkepolja on Saturday September 25, 2021 @02:17AM
(#28650929)
Yeah they are very primitive :(