News for hackers. Stuff that matters.

Ask HN: What are you using Go for?

I'm interested in knowing what HNers are doing with Go (other than learning about it, though it would be interesting to hear about learning projects too). Thanks.
( 39 comments | 22 points | on HN )
Re:Ask HN: What are you using Go for? by dkuntz2 on Monday December 30, 2013 @02:48PM (#6986453)
A collaborative music jukebox that lets multiple people listen to the stream over a network. Because cloud-based jukeboxes seem to be all the rage, but none of them let you play music with other people at the same time. We gave it a fun name too: https://github.com/turbowookie/turbo-wookie. Go is used for the HTTP server, and is basically a layer over interacting with MPD.

Also working on a flat-file blogging system with an online editor, because flat-file is the middle ground between a static-site generator and a traditional database-based blogging engine.

Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @04:47PM (#6987208)
Innovative use of Go, I must say.
Re:Ask HN: What are you using Go for? by dkuntz2 on Monday December 30, 2013 @05:55PM (#6987647)
It was a school project. We were the only team to use new technologies. Everyone else used Java or C# (with one group using PHP). Go seemed cool. Dart (which we used for the frontend) also seemed cool.
Re:Ask HN: What are you using Go for? by lazyjones on Monday December 30, 2013 @12:36PM (#6985650)
After dabbling with it for a couple of weeks, I wrote the backend (search & indexing implementation using the Go standard library's suffix array implementation) of our websites' autocomplete feature. It's been running for 7 months without a crash and without leaking memory, serving several million requests/day.

I'd like to use it more, but we have so many layers of legacy Perl code, that it's difficult to replace single components because of their dependencies (rewriting anything worthwhile would mean rewriting 4-5 libraries also).

Re:Ask HN: What are you using Go for? by workhere-io on Monday December 30, 2013 @07:33PM (#6988155)
It's been running for 7 months without a crash and without leaking memory, serving several million requests/day.

Sounds cool. What kind of server are you running this on?

Re:Ask HN: What are you using Go for? by lazyjones on Monday December 30, 2013 @07:54PM (#6988249)
> What kind of server are you running this on?

It runs on a single node of a 4-in-1 supermicro server with dual Opteron 6136 CPUs. Because it uses so little CPU time (about 15% of one core on average), we are now using the server for other things as well ...

Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @01:54PM (#6986127)
Cool ...
Re:Ask HN: What are you using Go for? by bliti on Monday December 30, 2013 @02:02PM (#6986176)
As the public entry point towards many internal APIs. Its lighter and faster than any scripting language. Gorilla toolbox made it very easy to write.
Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @03:42PM (#6986803)
Interesting use case.
Re:Ask HN: What are you using Go for? by bliti on Monday December 30, 2013 @11:12PM (#6988904)
It was to simplify a rather complicated system that used bots. Each bot would report home by requesting different URLs. That seemed overly complicated to me, because one URI change would break every single bot. I then created the public interface and simplified it to one URI. Then the data structure being sent to the APIs got an additional parameter. It told the public interface which API had to get that data. This was a very simple change, because the data structure was defined by the APIs and common among all. It ended up being very fast and allowed the bots to spend less time waiting for a response. Was planning to add a messaging queue but then I left the project (I was a consultant).
Re:Ask HN: What are you using Go for? by vram22 on Tuesday December 31, 2013 @11:53AM (#6991406)
>Then the data structure being sent to the APIs got an additional parameter. It told the public interface which API had to get that data.

Nice technique.

Re:Ask HN: What are you using Go for? by bliti on Tuesday December 31, 2013 @05:21PM (#6993161)
I call it the "Boarding Pass Pattern." I modeled it after the typical airplane boarding pass where everyone has the same data structure yet is going to different places/doing different things. :)
Re:Ask HN: What are you using Go for? by vram22 on Wednesday January 01, 2014 @12:59PM (#6995701)
Good name :) Another possible name could be the Differentiator Pattern (heh, just a wild try), since it differentiates between calls which otherwise have the same data. Or even the Call Router pattern, for obvious reasons ...
Re:Ask HN: What are you using Go for? by sergiotapia on Thursday January 09, 2014 @12:13PM (#7031665)
I'm using it to scrape a popular gaming API endpoint to get info on hundreds of matches per day. I chose Go because it's fast, easily deployable and I enjoy it. :)
Re:Ask HN: What are you using Go for? by nnash on Thursday January 09, 2014 @12:18PM (#7031702)
Dotabuff? Awesome work if its you.
Re:Ask HN: What are you using Go for? by joewalnes on Monday December 30, 2013 @02:10PM (#6986221)
Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @03:15PM (#6986639)
Just checked the github page for it. Looks interesting and useful. Could be used to push system monitoring data to a browser (among tons of other uses, of course). Trying it out ...
Re:Ask HN: What are you using Go for? by joewalnes on Monday December 30, 2013 @05:18PM (#6987414)
Here's an example of using it to build a quick Linux system monitoring dashboard: https://github.com/joewalnes/web-vmstats
Re:Ask HN: What are you using Go for? by vram22 on Friday January 03, 2014 @02:15PM (#7007419)
Wrote something similar but without much GUI, here:

http://jugad2.blogspot.in/2014/01/websocketd-and-python-for-...

websocketd is a good tool.

Re:Ask HN: What are you using Go for? by vram22 on Tuesday December 31, 2013 @11:55AM (#6991416)
Thanks, I'm checking that one out.
Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @04:33PM (#6987113)
Tried websocketd, getting some issue using it. Emailing you about it offline.
Re:Ask HN: What are you using Go for? by vram22 on Tuesday December 31, 2013 @11:54AM (#6991411)
Thanks Joe, solved the problem with your suggestion to use PYTHONUNBUFFERED=true.
Re:Ask HN: What are you using Go for? by blooberr on Thursday January 02, 2014 @06:20AM (#6999118)
I work with streaming data and Go has been great reducing the number of backend workers (formerly in Ruby) to handle about 1 TB/day in real time. It's very stable and great for building an internal data aggregator.

A friend has also been using Go to create a board game as his side project.

Re:Ask HN: What are you using Go for? by vram22 on Thursday January 02, 2014 @01:49PM (#7001321)
Interesting about the data volume.

What's used for the GUI of the game?

Re:Ask HN: What are you using Go for? by blooberr on Thursday January 02, 2014 @02:03PM (#7001429)
HTML 5 canvas.
Re:Ask HN: What are you using Go for? by charlesdm on Monday December 30, 2013 @11:55AM (#6985396)
Not using Go in production, but I've been looking at using it for a mobile API for a stateful system (with both a REST and Websocket interface). Seems to be great for realtime system with a lot of different data inputs.
Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @12:31PM (#6985617)
Interesting.
Re:Ask HN: What are you using Go for? by wilsonfiifi on Tuesday December 31, 2013 @12:37PM (#6991655)
Bytengine : https://github.com/johnwilson/bytengine Work in progress but man is Go fun!
Re:Ask HN: What are you using Go for? by vram22 on Tuesday December 31, 2013 @01:55PM (#6992155)
Had a quick look at Bytengine. Like the idea of using Linux-like file paths to refer to documents.

>Files are JSON documents to which you can attach any binary/text data (docx, txt, pdf, jpeg, etc...).

I'm guessing you store the filename(s) of the attached data (docx, txt, pdf, ...) in the JSON fragment?

Re:Ask HN: What are you using Go for? by Wezc on Monday December 30, 2013 @04:10PM (#6986975)
Docker is writing in Go (http://www.docker.io/)
Re:Ask HN: What are you using Go for? by vram22 on Monday December 30, 2013 @04:31PM (#6987108)
Yes, had seen that some days ago, but thanks.

I had blogged about Docker using LXC, as part of this post about Domino, a Python PaaS for data science:

http://jugad2.blogspot.in/2013/12/domino-paas-for-data-scien...

and had seen then that Docker uses Go, though I didn't say so in the post.

Cool.

Re:Ask HN: What are you using Go for? by zachlatta on Monday December 30, 2013 @03:39PM (#6986787)
I've been using it primarily for a little bit of systems programming and writing internal utilities at work.
Re:Ask HN: What are you using Go for? by vram22 on Tuesday December 31, 2013 @12:00PM (#6991442)
Utilities seems like a good use of Go, apart from the others I'm aware of. I mean command-line ones.
Re:Ask HN: What are you using Go for? by dded on Tuesday December 31, 2013 @04:12PM (#6992872)
> Utilities seems like a good use of Go

Can you elaborate? I'm unfamiliar with Go, but most of my Python (and Perl, sigh) coding could be classified as "utilities for work". I would have thought that any language with an explicit compile step would be at a disadvantage in this space.

Re:Ask HN: What are you using Go for? by vram22 on Wednesday January 01, 2014 @01:24PM (#6995811)
>Can you elaborate?

Sure.

>I would have thought that any language with an explicit compile step would be at a disadvantage in this space.

Not exactly, and not always. In fact it can be the opposite. It depends on a few factors, and there are tradeoffs.

Consider that so many of the command-line utilities that come bundled with Unixen (Unix, Linux, BSD) are written in C - just look in /bin, /usr/bin, etc (some of the default dirs in $PATH). (Do a "file * | less" in those dirs.)

(Though there definitely are utilities that are written purely in *sh, or Perl, or Python, and more so these days than some years ago. Still, some, particularly shell scripts, tend to make calls to compiled utilities such as sed, awk, grep, ls, du, df, ps, and many other commands.)

For utilities used often or heavily, or where performance is important, a compiled binary can often be a good choice: lower startup time (don't have to start the interpreter to run the script, often faster run time (because running compiled machine code vs. interpreted or JIT'ed).

Go has performance closer to C than Python does, and also has some aspects of HLL's (High Level Languages) like Python. The compile only has to be done once per machine or platform, remember; also, Go compilation is quite fast, which was a design goal of the language. And if you compile once on one machine, you can just copy the binary (in an automated way, too) to any number of other machines running the same OS and version. With a self-sufficient binary, you avoid both the issues of missing or incorrect dynamically loaded libraries of languages like C (if the C program uses them), and the issues of missing or wrong versions of required libraries, with languages like Python.

Those are some reasons I could think of, off the top of my head. There may be others, both pro and con.

Re:Ask HN: What are you using Go for? by vram22 on Wednesday January 01, 2014 @01:28PM (#6995836)
More reasons: some of the Go language creators were heavily involved in the creation of Unix and C, and while I don't know it for a fact, it's pretty likely that they intended and designed Go to be useful for command-line tools as well, e.g. servers, utilities, etc. Also, Go has the flags package for handling command-line arguments (though other languages like Python do have various libs for that too).
Re:Ask HN: What are you using Go for? by vram22 on Thursday January 02, 2014 @02:31PM (#7001660)
Also, though not directly related to your question, Torbit (later acquired by Walmart Labs), used Go, due to its combination of productivity and performance. Josh Fraser, Torbit co-founder, told me that.

http://www.torbit.com/

http://www.onlineaspect.com/about/ (Josh's site)

Re:Ask HN: What are you using Go for? by dded on Wednesday January 01, 2014 @07:51PM (#6997579)
> a compiled binary can often be a good choice

Uh, well, sure. From the context, I thought little ad hoc utilities were meant. The kind that are changed frequently. We keep many right in our svn repository, so you make a check-out and make use of a little script right in the same directory as your project source code.

Re:Ask HN: What are you using Go for? by vram22 on Thursday January 02, 2014 @02:06PM (#7001457)
>I thought little ad hoc utilities were meant.

The thing is, given Go's compilation speed, little utilities will compile so fast that you'll barely notice it (on any decently powerful machine), and on the other side there's the overhead of starting up the Python or Perl interpreter.

There's also the "go run" command, so you don't even have to give two separate commands (compile and run).

http://golang.org/cmd/go/

The command "go run filename.go" compiles the specified Go source file and then runs the resulting binary (assuming no compile-time errors, of course).