What is the blank identifier (_) in Go?

Answer

The blank identifier _ is a write-only variable that discards any value assigned to it. It signals to the compiler and readers: "I am intentionally ignoring this value." Common uses include discarding unwanted return values (_, err := fmt.Println("hi")), ignoring a loop variable (for _, v := range items), and importing a package solely for its side effects (import _ "database/sql/driver"). Go's strict "no unused variables" rule would cause a compile error for a named variable that is never read, so _ is the sanctioned escape hatch.