News for hackers. Stuff that matters.
Re:GopherJS – A compiler from Go to JavaScript by shurcooL on Tuesday October 14, 2014 @02:21PM (#8454868)
I've been using it for some time and it's really hard to believe how it just works for so many things.

https://gopherjs.github.com/playground/ - GopherJS Playground.

(It compiles Go code to JavaScript in your browser using the GopherJS compiler itself compiled to JavaScript. There is no backend being used.)

https://godoc.org/honnef.co/go/js/dom - DOM bindings.

https://godoc.org/honnef.co/go/js/xhr - XHR bindings.

Re:GopherJS – A compiler from Go to JavaScript by danesparza on Tuesday October 14, 2014 @03:36PM (#8455275)
I'm genuinely curious to know what you've been using it for.
Re:GopherJS – A compiler from Go to JavaScript by dmitshur on Tuesday October 14, 2014 @04:14PM (#8455507)
Multiple things.

- Making my Markdown Format package for Atom have zero external dependencies by compiling the Go code into JavaScript. That way there's no need to install and point to the markdownfmt binary, making install easier. https://github.com/shurcooL/atom-markdown-format/commit/6b5f...

- Replacing JavaScript with Go code in Go Package Store, still a WIP PR because I need to figure out a `go get` difficulty, but aside from that it works perfectly well. https://github.com/shurcooL/Go-Package-Store/pull/18

- Various experimental things that run in the browser and perform operations that use existing Go code. For example: https://dl.dropboxusercontent.com/u/8554242/dmitri/projects/... https://dl.dropboxusercontent.com/u/8554242/dmitri/projects/...

- At work, I've created a small standalone project with a frontend UI that reused some common structs and html template code between the frontend and backend (ala node.js, except all in Go).

- Working on porting my small OpenGL game written in Go to run in the browser. The goal is to have the same Go code use OpenGL when on desktop, but use GopherJS and WebGL when compiling for the browser.

Basically, it lets me do all the things that one would normally be forced to use JavaScript for (i.e., frontend code) but without having to use JavaScript (I'm not good at it and I don't like it), while benefitting from Go compiler to catch errors, autocomplete, godocs, goimports, etc. It also allows me to import and use existing Go packages that perform non-trivial tasks.

Re:GopherJS – A compiler from Go to JavaScript by syntern on Tuesday October 14, 2014 @04:38PM (#8455646)
Do you have any shareable code for the OpenGL cross-compilation?
Re:GopherJS – A compiler from Go to JavaScript by shurcooL on Tuesday October 14, 2014 @04:53PM (#8455743)
I don't have a complete solution yet, but I can share some links:

https://github.com/azul3d/issues/issues/29 - Very relevant discussion with good resources/links/info.

https://github.com/ajhager/engi - 2D game library for Go with desktop/browser/android targets.

https://github.com/shurcooL/play/tree/master/57 - Simple WebGL/GopherJS render triangle demo.

https://github.com/shurcooL/play/tree/master/58 - Unfinished attempt to make the above compiled to two desktop/browser targets.

Re:GopherJS – A compiler from Go to JavaScript by EugeneOZ on Tuesday October 14, 2014 @04:53PM (#8455744)
Does it add type checks into compiled code to emulate strict typing? Types of variables in the source code we can check by go itself, but there are server responses (JSON) where we don't have checked types. Really interesting.