Go Structs (Part 1) — Anonymous Structs

Photo by Kelli McClintock on Unsplash

With a regular struct, you define the struct, and then you use that struct definition to declare variables. Anonymous Structs on the other hand lets you create struct-based data-type variables without needing to define the struct.

This article is part of the Structs in Go series.

First, here’s a reminder of what a regular struct looks like, we define the struct (lines…