Recent Articles

How the Gophers Are Made

A deep dive into how the Gopher graphics and logos are created for my programming courses.

Building a Blog in Go: Metadata via Frontmatter

My Go blog has a way to render individual posts, but it is still missing metadata about each post. Information like the author of the post, when it was published, etc. In this part of the build a blog series we focus on adding frontmatter so that we can properly render this for each blog post, but also in preparation for when we want to show a list of all of our blog posts.

Building a Blog in Go: Rendering Markdown as HTML

Now that our blog can render plaintext markdown, I was ready to start converting the markdown into HTML and rendering it nicely. The first step was to find a markdown processing library and start using it. After that I added code syntax highlighting, and finished up with an HTML template so I could render a navbar and other common elements on every page that shows a blog post.

Building a Blog in Go: Rendering Raw Markdown

The first step I took when building my Go blog was to setup a simple HTTP server that can return the slug of the blog. This is a unique identifier for the blog that is a bit more url-friendly. From there I worked on the code necessary to read files from the local disk and started rendering the raw markdown to the HTTP handler in preparation for the next part of this series where I will start rendering the markdown in proper HTML.

Building a Blog Exercise

In this series we work through building a blog in Go. The first article helps set the scene by explaining what we are going to build, what to expect from the series, and provides some suggestions on how to break down the problem and proceed if you want to try coding it on your own first.

Does Go's range Copy a Slice Before Iterating Over It?

This week someone in my Go courses Slack asked why their for loop wasn’t working the way they expected. More specifically, they were wondering if Go’s range keyword was copying their slice before iterating over it. I won’t use the exact same code here, but we can look at a similar example by trying to generate the Fibonacci sequence. If you don’t know what the Fibonacci sequence is, don’t worry.

Popular Articles

6 Tips for Using Strings in Go

Learn how to perform common operations with strings in Go. This article discusses how to write multiline strings, concatenate strings efficiently, convert various data types into strings, checking for prefixes, and converting strings to byte slices.

Using Functions Inside Go Templates

Go's template package provides many useful built-in functions. Learn to use a few of the more common ones, as well as how to add custom fucntions to your templates so that you can add any functionality you need.

Connecting to a PostgreSQL database with Go's database/sql package

This tutorial explains how to connect to a Postgres DB using the database/sql and lib/pq packages. It also covers potential errors and solutions.

Creating Random Strings in Go

A tutorial explaining how to create a custom rand package with functions for creating random strings of varying length with custom of preset character sets.

Inserting records into a PostgreSQL database with Go's database/sql package

Learn to insert new records into a Postgres database using Go's database/sql package, along with how to get the resulting ID of newly created records.

How to use slice capacity and length in Go

Learn about the difference between capacity and length and how to properly utilize them to make your Go code faster, cleaner, and memory efficient.

My Latest Progress Update

Writing Course Notes

In this progress update we explore why it takes me so long to complete a project when using it to come up with course notes. I'll also give you an inside look at my notes that I use for courses.

View past progress updates

↓ Or check out some of my longer series. ↓

Each series covers a broader topic and is composed of several articles

Using PostgreSQL with Go

PostgreSQL is an open source relational database system that has been around for well over a decade and has proven to be a great all around storage choice when developing a web application.

In this series we are going to walk through everything from first installing PostgreSQL 9.5 all the way to using it with a Go application. While this post will cover all of the basics required to get started using SQL with Golang, it is not a full course on SQL. It is instead intended to guide you by giving you enough information to be productive, while not overloading you with details that can be learned as you progress.

In this series we will cover topics like:

  • Installing PostgreSQL on various operating systems (Ubuntu Linux, Mac OS, etc)
  • Interacting with a PostgreSQL database using raw SQL. This includes querying, inserting, updating, and deleting records.
  • Interacting with a PostgreSQL database using the database/sql package provided by Go's standard library. Again, this includes querying, inserting, updating, and deleting records.
  • Using ORMs and other third party librarys to interact with SQL databases
Let's Learn Algorithms

This series is no longer being updated. Instead, check out the course I created based on it - Algorithms with Go

Algorithms are a core component in a computer science education, and when taught properly they can help a developer improve his or her skills massively. In this series we will work to both understand how common computer algorithms work, as well as how to properly code each of them in Go.

By coding each algorithm as we learn it, you will develop the skills necessary to translate a conceptual idea into correct and efficient code. While many developers will know how to solve a problem set before them, oftentimes bugs and issues can stem from minor mistakes that algorithm practice can help remedy.

In addition to coding each algorithm we will also discuss how it works as well as the efficiency of each algorithm. That is, we will discuss how fast or slow the code will be based on the size of the input. This is important because in many real world situations you can opt for simpler - but slower - code if you know your inputs won't be too large. Alternatively, you could determine that the simpler solution won't work for your inputs and know that you will need to spend some extra time on a more efficient algorithm.

If you are relatively new to programmer, or simply don't have a formal computer science education, I invite you to check out these articles. You won't be disappointed!

Avatar of Jon Calhoun
Articles and Tutorials by
Jon Calhoun

Jon Calhoun is a full stack web developer who teaches about Go, web development, algorithms, and anything programming. If you haven't already, you should totally check out his Go courses.

Previously, Jon worked at several statups including co-founding EasyPost, a shipping API used by several fortune 500 companies. Prior to that Jon worked at Google, competed at world finals in programming competitions, and has been programming since he was a child.

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

©2024 Jonathan Calhoun. All rights reserved.