Tagged articles
7 articles
Page 1 of 1
Raymond Ops
Raymond Ops
Mar 19, 2025 · Fundamentals

Unlocking Go’s Empty Interface: How Any Type Becomes a Value

This article explains Go’s empty interface, showing how it can hold values of any type, how to declare and use it in functions and data structures, and why copying between concrete slices and empty‑interface slices requires element‑wise assignment due to its two‑word memory layout.

GoInterfaceSlice
0 likes · 5 min read
Unlocking Go’s Empty Interface: How Any Type Becomes a Value
Liangxu Linux
Liangxu Linux
Aug 4, 2024 · Backend Development

Mastering Go’s Empty Interface: Store Any Type and Copy Data Safely

This guide explains Go's empty interface, how any value can be stored in it, demonstrates declaring variables and functions with interface{}, shows practical slice examples, discusses memory layout, and provides the correct way to copy data into an empty‑interface slice.

GolangInterfaceSlice
0 likes · 5 min read
Mastering Go’s Empty Interface: Store Any Type and Copy Data Safely
MaGe Linux Operations
MaGe Linux Operations
Jun 29, 2024 · Fundamentals

Unlock Go’s Empty Interface: Store Any Type Anywhere

An empty interface in Go, defined without methods, can hold values of any type, enabling flexible data structures like slices, maps, and structs, and is commonly used in functions such as fmt.Println; this article explains its definition, usage, memory layout, and copying nuances with code examples.

Code Examplesempty interfacegeneric programming
0 likes · 6 min read
Unlock Go’s Empty Interface: Store Any Type Anywhere
MaGe Linux Operations
MaGe Linux Operations
Apr 29, 2024 · Fundamentals

Unlocking Go’s Empty Interface: Store Any Type in One Variable

An empty interface in Go, defined as interface{}, can hold values of any type because it has no methods, enabling flexible data structures like slices, maps, and structs, and is commonly used in functions such as fmt.Println, though copying between typed and empty interface slices requires careful handling.

GoInterfaceempty interface
0 likes · 5 min read
Unlocking Go’s Empty Interface: Store Any Type in One Variable
MaGe Linux Operations
MaGe Linux Operations
Apr 27, 2024 · Fundamentals

Mastering Go Types and Interfaces: A Deep Dive into Reflection

This article explains Go's static type system, introduces custom types and interface definitions, demonstrates how interfaces store concrete values, and shows how the reflect package can inspect and modify values, covering empty interfaces, type assertions, and mutable reflect values with practical code examples.

InterfacesReflectionempty interface
0 likes · 14 min read
Mastering Go Types and Interfaces: A Deep Dive into Reflection