Testing API Clients in Go

Sunday, September 24, 2017

Let’s imagine you are building an API client in Go to make it easier for people to interact with your public REST API. Everything is going great. You’ve got authentication, pagination and awesome error handling in place. One thing that’s still unresolved though is how do you test it? Your client exists to make HTTP requests and then unmarshal that response data (presumably JSON) into objects that make it easy for your consumers to work with.

Option Types with go generate

Sunday, August 20, 2017

This post is about a library and command I created called optional with the help of go generate. The code is here: https://github.com/markphelps/optional if you want to follow along. I’ve been coding in Go for some time now, and one thing I miss from my Java days is the ability to express an option type. An option type (from the Java docs) is: A container object which may or may not contain a non-null value.

Functions as State

Thursday, November 3, 2016

Recently I’ve been working on a Slack bot project in Go using the wonderful nlopes/slack client. While nlopes makes it easy to post and consume messages to and from Slack, either via the Web API or Real Time API, I found myself struggling when trying to maintain conversation state between users and the bot. Any good Slack bot is able to listen to and respond to messages given some cue or trigger.

Writing a Ray Tracer in Go - Part 5

Sunday, July 24, 2016

This is the 5th and final post of my series on writing a ray/path tracer in Go. Check out the previous parts 1, 2, 3 and 4. I’m roughly following the e-book Ray Tracing in One Weekend, but translating all of the code into Go. All of the code for this post can be found on my Github. Last time we added metal and matte materials, giving us the ability to render the following image:

Writing a Ray Tracer in Go - Part 4

Friday, June 3, 2016

This is part 4 of my series on writing a ray/path tracer in Go. Check out parts 1, 2 and 3. I’m roughly following the e-book Ray Tracing in One Weekend, but translating all of the code into Go. All of the code for this post can be found on my Github. Last time we added the ability to shade our sphere and added anti-aliasing to make everything look better.

Writing A Ray Tracer in Go - Part 3

Sunday, May 8, 2016

This is part 3 of my series on writing a ray/path tracer in Go. Checkout parts 1 and 2. I’m roughly following the e-book Ray Tracing in One Weekend, but translating all of the code into Go. All of the code for this post can be found on my Github. Last time I covered the basics of creating rays, spheres and calculating if a ray intersects a given sphere. In order to visualize our sphere, last time we colored a pixel red if a ray intersected it and some shade between blue and white if it did not.

Writing A Ray Tracer in Go - Part 2

Saturday, March 26, 2016

This is part 2 of my journey to try and write a ray/path tracer in Go. Checkout part 1 here. I’m roughly following the e-book Ray Tracing in One Weekend, but translating all of the code into Go. In the previous post we covered how a path tracer works and got an image to display on the screen by blending red, green and blue into a cool looking gradient. This time around we’ll draw a sphere instead, but by actually sending rays into the scene and marking the pixels where they hit the object.

Writing a Ray Tracer in Go

Tuesday, March 15, 2016

I’ve been wanting to learn Go for awhile now. I bought a book, read several blogs and tutorials, but I still didn’t feel like I was really getting anywhere with the language. A few weeks ago I went with my a few of my co-workers to the Triangle Golang meetup hosted by my friend Brett, and met some great people. One of the guys demoed an amazing project he had worked on, building a ray tracer in Go.