[Golang] Online Snake Game by GopherJS


Demo (Fork me on Github)

In GopherJS DOM Example series, we show a lot of examples of DOM manipulation by GopherJS and its DOM binding. Now we will use what we learn to write a simple snake game. I wrote an online snake game in Dart (see [5]) before. This Golang snake game is ported from the Dart version. The DOM APIs provided by GopherJS and its DOM bindings are basically the same as JavaScript DOM APIs, except it is re-written in idiomatic Go. This is a good exercise to make you familiar with DOM manipulation in Go programming language.

Source Code for Demo (HTML):

Source Code for Demo (CSS):

Source Code for Demo (Go):


Tested on: Ubuntu Linux 15.10, Go 1.5.2.