TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

GopherJS – A compiler from Go to JavaScript

174 pointsby primrootover 10 years ago

14 comments

jimmcslimover 10 years ago
Showing my age, but until I read the full headline I thought this was a JavaScript client for the Gopher protocol...<p><a href="http://en.wikipedia.org/wiki/Gopher_(protocol)" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Gopher_(protocol)</a><p>Time to pour one out for protocols loved and lost...
shurcooLover 10 years ago
I&#x27;ve been using it for some time and it&#x27;s really hard to believe how it just works for so many things.<p><a href="https://gopherjs.github.com/playground/" rel="nofollow">https:&#x2F;&#x2F;gopherjs.github.com&#x2F;playground&#x2F;</a> - GopherJS Playground.<p>(It compiles Go code to JavaScript in your browser using the GopherJS compiler itself compiled to JavaScript. There is no backend being used.)<p><a href="https://godoc.org/honnef.co/go/js/dom" rel="nofollow">https:&#x2F;&#x2F;godoc.org&#x2F;honnef.co&#x2F;go&#x2F;js&#x2F;dom</a> - DOM bindings.<p><a href="https://godoc.org/honnef.co/go/js/xhr" rel="nofollow">https:&#x2F;&#x2F;godoc.org&#x2F;honnef.co&#x2F;go&#x2F;js&#x2F;xhr</a> - XHR bindings.
评论 #8455275 未加载
评论 #8455744 未加载
andrewchambersover 10 years ago
I&#x27;d like to point out that goroutine support has been added which allows concurrency in the browser. You can literally avoid using callback soup using this.<p>its like clojure core.async only more powerful.
评论 #8455570 未加载
Cyranixover 10 years ago
Can anyone speak to the trade-off in file size, for non-trivial codebases? There is a stated design goal of &quot;small size of generated code&quot;, but the default snippet in the playground introduces quite a large amount of boilerplate. Is the penalty on file size fairly front-loaded or does the generated code scale horribly?
评论 #8456023 未加载
评论 #8455817 未加载
评论 #8456417 未加载
Rapzidover 10 years ago
Is there any hope for a workflow similar to clojurescripts? It&#x27;s very nice to have your page hooked to the repl and be able to re-evaluate pieces of code then have the page functionality change without constant refreshes and recompiles.<p>Edit: I want to expand on this a bit. I&#x27;m curious about how the workflow is now and what&#x27;s envisioned. Things like the above mentioned and also LightTables insta-repl make for great workflow value propositions. I very much like Clojure, but I like Go as well and have written much, much more of it. So this is very interesting, but.. Do I need to write the Go code blind, then compile to js, then refresh and test my page to see what&#x27;s going on?
评论 #8456931 未加载
评论 #8456986 未加载
kevingaddover 10 years ago
Does this support pointers&#x2F;memory buffers and other systems programming stuff? It&#x27;s unclear to me from the compatibility table&#x2F;etc.
评论 #8455627 未加载
beefsackover 10 years ago
Boy would I love to see someone take this and create a reactive web library akin to what Meteor and DerbyJS are trying to achieve.
fizzbatterover 10 years ago
Anyone know how hard it would be to get a ReactJS binding setup for this? I was literally just looking into GopherJS (for a normal frontend stuff) - but i&#x27;m unsure how gnarly it would be to setup bindings.<p>Part of me fears the output though. It can be rather verbose, large, and is quite abstract from the original code. Debugging and code-size worry me greatly.
评论 #8455851 未加载
jinchekerover 10 years ago
I would say that&#x27;s a great work. But, in order to write efficient code, you still need to understand both languages. It just saves you time to remember JavaScript syntax. Since we have google and stackoverflow, people can pretty much write more idiomatic code than machine. So the conclusion is not worth it.
ankurpatelover 10 years ago
Can this create appropriate ASM.js code?
评论 #8455790 未加载
agumonkeyover 10 years ago
For alternatives see (7 month old) : <a href="http://www.reddit.com/r/golang/comments/1z2bc4/a_transpiler_from_go_to_javascript_for_running_go/cfpxphl" rel="nofollow">http:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;golang&#x2F;comments&#x2F;1z2bc4&#x2F;a_transpiler_...</a>
Leszekover 10 years ago
Does it self-host? That is, could we have a fully client-side Go-in-the-browser?
评论 #8455936 未加载
aclissoldover 10 years ago
Why use a server-side language developed by Google (Go) as an alternative to JavaScript, when you could use a client-side language developed by Google and intended as an alternative to JavaScript (Dart)?
waluover 10 years ago
It remained me of GWT that is disappeared for a long time. hah
评论 #8457426 未加载
评论 #8457046 未加载