All Articles

Show me your username and password requirements at login

This isn’t something I normally write about, but after the hundredth time creating an account with random password or username restrictions I am starting to lose my patience with companies. If you are going to require that my username or password have special characters, numbers, capital and lowercase letters, or anything else, show those requirements on the login page. No, hiding this information on the login page isn’t making your site more secure.

Querying for a single record using Go's database/sql package

In this article we cover how to query for a single record using Go's database/sql package, including handling the ErrNoRows error.

Updating and deleting PostgreSQL records using Go's sql package

Learn how to update and delete records with the database/sql package in Go. We also cover how to verify how many records were altered and return data from those rows.

How to shuffle arrays and slices in Go

If you are transitioning into Go from a language like Python or Ruby, at some point or another you are going to start missing one of the many helper functions offered by the language. The most recent example of this for me was when I wanted to shuffle a slice. In Ruby this is as simple as calling the shuffle method. array = [1, 2, 3, 4, 5] array.shuffle # shuffles the array!

How to determine if a JSON key has been set to null or not provided

Learn to distinguish between when a JSON key is set to null or the key wasn't provided at all when dealing with JSON in Go.

Pitfalls of context values and how to avoid or mitigate them in Go

Storing data in a context.Context, or as I refer to it - using context values, is one of the most contentious design patterns in Go. Storing values in a context appears to be fine with everyone, but what specifically should be stored as a context value receives a lot of heated discussion. I’ll be honest - when I started using them I used them in the naive and somewhat inappropriate way that everyone complains about.

Avatar of Jon Calhoun
Articles and Tutorials by
Jon Calhoun

Jon Calhoun is a full stack web developer who also teaches about Go, web development, algorithms, and anything programming related. He also consults for other companies who have development needs. (If you need some development work done, get in touch!)

Jon is a co-founder of EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure, and prior to founding EasyPost he worked at google as a software engineer.

Jon's latest progress update: Writing Course Notes

Recent Articles All Articles Mini-Series Progress Updates Tags About Me Go Courses

©2018 Jonathan Calhoun. All rights reserved.