Go Type Tagging
Intro Mixing up the values passed to functions and structs are a common mistake in many programming languages. This happens even more often with languages that have dynamic type system.
Here is a trivial example which illustrates this problem:
type User struct { UserName string Email string Password string } func NewUser( UserName string, Email string, Password string, ) User { return User { UserName, // The Password is passed as an Email Password, Email, } } In this post we leverage the system to handle these kind of bugs and see which other advantages this approach offers.