←back to thread

153 points yar-kravtsov | 1 comments | | HN request time: 0.325s | source

I built a Vite plugin that lets you write Go code directly in .js files using a "use golang" directive. It compiles to WebAssembly automatically.
Show context
tkzed49 ◴[] No.45719084[source]
Beautiful. Minor feedback: rather than having a "use golang" directive, just allow imports of .go files. This is more idiomatic for JS bundlers.
replies(4): >>45720617 #>>45720828 #>>45721171 #>>45727246 #
1. CamouflagedKiwi ◴[] No.45721171[source]
That would also avoid the problem with this syntax, that it's not a valid Go file (it doesn't start with `package ...` and I don't think a bare top-level string is valid), which lots of editors will be pretty unhappy about.