Going Go Programming Recent Posts

Composition with Go

Composition goes beyond the mechanics of type embedding. It’s a paradigm we can leverage to design better APIs and to build larger programs from smaller parts. It all starts from the declaration and implementation of types that have a single purpose. Programs that are architected with composition in mind have a better chance to grow and adapt to changing needs. They are also much easier to read and reason about.

Object Oriented Programming Mechanics

Go is an object oriented programming language. It may not have inheritance, but in this 20 minute video from the Bangalore meetup, I will show you how object oriented programming practices and techniques can be applied to your Go programs. From an object oriented standpoint, Go does provides the ability to add behavior to your types via methods, allows you to implement polymorphic behavior via interfaces and gives you a way to extend the state and behavior of any existing type via type embedding.

Scheduler Tracing In Go

Introduction One of the things I love about Go is the profiling and debug information you can generate. There is a special environmental variable named GODEBUG that will emit debugging information about the runtime as your program executes. You can request summary and detailed information for both the garbage collector and the scheduler. What’s great is you don’t need to build your program with any special switches for it to work.

Stack Traces In Go

Introduction Having some basic skills in debugging Go programs can save any programmer a good amount of time trying to identify problems. I believe in logging as much information as you can, but sometimes a panic occurs and what you logged is not enough. Understanding the information in a stack trace can sometimes mean the difference between finding the bug now or needing to add more logging and waiting for it to happen again.

Using Pointers In *Go

Introduction I am asked quite a bit about when and when not to use pointers in Go. The problem most people have, is that they try to make this decision based on what they think the performance tradeoff will be. Hence the problem, don’t make coding decisions based on unfounded thoughts you may have about performance. Make coding decisions based on the code being idiomatic, simple, readable and reasonable. My use of pointers is based on discoveries I have made looking at code from the standard library.

Error Handling In Go, Part II

Introduction In part I of this post, we learned about the error interface and how the standard library provides support for creating error interface values via the errors package. We also learned how to work with error interface values and use them to identify when an error has occured. Finally, we saw how some packages in the standard library export error interface variables to help us identify specific errors. Knowing when to create and use custom error types in Go can sometimes be confusing.

Error Handling In Go, Part I

Introduction It is idiomatic in Go to use the error interface type as the return type for any error that is going to be returned from a function or method. This interface is used by all the functions and methods in the standard library that return errors. For example, here is the declaration for the Get method from the http package:   Listing 1.1   http://golang.org/pkg/net/http/#Client.Get func (c *Client) Get(url string) (resp *Response, err error) Listing 1.

Go Compiler nil Pointer Checks

Introduction I was thinking about how the compiler looks to protect the code we write when it can. Invalid memory access checks are one type of safety check the compiler adds to our code. We might think that this "extra code" is hurting our performance and maybe over billions of iterative operations it is. However, these checks can prevent our code from causing damage to the systems we are running on.

ALS Ice Bucket Challenge - Go Style

If you have not heard about the ALS Ice Bucket Challenge I would be surprised. It’s everywhere nowadays, being done by celebrities alike. After being challenged by my children there was only one person, or should I say Gopher, I knew I needed to nominate. The Gopher took to the challenge and here it is: I would like to thank my daughter for spending time today filming and editing the video.

Ice Cream Makers and Data Races Part II

Introduction Dave Cheney published a post called Ice Cream Makers and Data Races. The post showed an example of an interesting data race that can occur when using an interface typed variable to make a method call. If you have not read the post yet please do. Once you read the post you will discover that the problem lies with the fact that an interface value is implemented internally using a two word header and that the Go memory model states only writes to a single word are atomic.

Ultimate Go Schedule

Location Start Date End Date Class Enrollment
Atlanta, Georgia Thursday, March 9th, 2017 at 9:00 AM Friday, March 10th, 2017 at 5:00 PM Ultimate Enroll Now
San Francisco, CA Tuesday, April 4th, 2017 at 9:00 AM Wednesday, April 5th, 2017 at 5:00 PM Ultimate Enroll Now
San Francisco, CA Tuesday, April 27th, 2017 at 9:00 AM Wednesday, April 28th, 2017 at 5:00 PM Data Enroll Now
Miami, FL Saturday, May 20th, 2017 at 9:00 AM Sunday, May 21st, 2017 at 5:00 PM Ultimate Enroll Now
Utrecht, Netherlands Friday, June 2nd, 2017 at 9:00 AM Sunday, June 4th, 2017 at 5:00 PM Ultimate Enroll Now
New York, NY Saturday, June 10th, 2017 at 9:00 AM Sunday, June 11th, 2017 at 6:00 PM Data Enroll Now