Image for post
Image for post
Go Gopher used under Creative Commons 3.0 license.

I promised my readers, all three of them, more on concurrency in Go a long time ago and I figure it’s about time to pay up.

This next pattern, also frequently called ranging over a channel, is one that I like a lot, but I have had trouble with this one. I always had to look it up because I kept forgetting how to close the channel at the right time. As an interesting aside, you don’t have to close a channel unless the receiver need to know that it has been closed. Otherwise you can just leave it open and it will get garbage collected. See this comment from Rob Pike for more about that. …

When I first started using Docker in 2015, it was like magic. It was when I first learned about containers and I remember staring at the Dockerfile blankly. Recently A coworker was asking me a bunch of questions about why their docker-compose setup wasn’t working. I don’t use docker-compose much at all, but the basic docker debugging I learned helped a lot. I am by no means an expect with containers or Docker, but I thought I would share some tips I learned. If you are looking for a container guru, check out Jessie Frazelle.

For the examples here, I am working with this repo…

I came from the Java world so I am familiar with the Java builder pattern. I didn’t use it much, but I reviewed some Go code recently that used a builder. It was written by a former Java dev and I have been thinking about it.

I came to the realization that, while you can use a builder pattern in Go, it really isn’t idiomatic.

A more idiomatic way to do the same thing is the options pattern. It’s used much the same way as the builder pattern.

Go Playground

If you are interested in more, check out Functional options for friendly APIs from Dave Cheney.

One of the strengths of Go is it’s native support for concurrency. There are a lot of posts about concurrency in Go, but I was writing this up as a simple example for a coworker and decided to publish it.

It takes a little getting used to if you don’t use concurrent programming a lot, but once you get beyond a couple hurdles, it’s a rockin’ good time. In addition, you can eliminate a whole class of bugs when you force all communication through channels. Then again, you open up another kind of bug. …

Image for post
Image for post

I like bitcoin. I like the idea of a distributed currency without centralization. That said, I am not a crypto expert and my experience with crypto currency is limited. I’m a software engineer and spend a fair amount of time playing with new tech so when I find out about new stuff, I like to get my feet wet. In 2013 I was studying computer science and found out about Bitcoin. The price of a Bitcoin was a few hundred dollars and I started mining to pay for my VPN subscription. I mined on my graphics card. I don’t remember the specific card, but it was a mid level Radeon. At first, I made about 0.1 bitcoin a week, but after a little while it slowed a lot. I think that’s when mass market ASIC machines started shipping. I remember reading about Butterfly Labs around that time. I mined on and off for about a year and then forgot about it. All in all, I made just shy of 1 bitcoin and used my proceeds for the aforementioned VPN subscription or sold it for a bit of cash. …


Guy J Grigsby

Technologist and taco lover.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store