Tag

slice

0 views collected around this technical thread.

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.

Goempty interfaceinterface{}
0 likes · 5 min read
Unlocking Go’s Empty Interface: How Any Type Becomes a Value
Go Programming World
Go Programming World
Feb 11, 2024 · Fundamentals

Recreating Liu Qian’s 2024 Spring Festival Gala Magic Trick Using Go

This article walks through a step‑by‑step Go implementation of Liu Qian’s 2024 Spring Festival Gala magic trick, explaining how to model the card‑handling algorithm with slices, shuffle, cuts, and loops, and provides complete source code and execution logs for readers to try.

DemoGoMagic Trick
0 likes · 10 min read
Recreating Liu Qian’s 2024 Spring Festival Gala Magic Trick Using Go
Laravel Tech Community
Laravel Tech Community
Dec 12, 2022 · Fundamentals

Go 1.20 Release Candidate Highlights: New Slice‑to‑Array Conversion, Unsafe Package Functions, and Comparable Types

Go 1.20 RC1 introduces experimental RISC‑V/FreeBSD support, expands slice‑to‑array conversion, adds three new unsafe package functions, updates comparable type constraints, and changes struct value comparison order, while being the final version compatible with macOS 10.13/10.14, with download details provided.

ComparableGoGo1.20
0 likes · 4 min read
Go 1.20 Release Candidate Highlights: New Slice‑to‑Array Conversion, Unsafe Package Functions, and Comparable Types
Tencent Cloud Developer
Tencent Cloud Developer
Jun 8, 2022 · Backend Development

Understanding Go Map and Slice Concurrency Safety and Parameter Passing

The article explains that Go maps and slices are not safe for concurrent reads or writes, describes how the runtime detects map violations, and recommends using sync.Mutex, sync.RWMutex, or sync.Map for maps and external synchronization for slices, while also clarifying that passing these reference types to functions shares underlying data unless explicitly copied.

ConcurrencyGolocking
0 likes · 12 min read
Understanding Go Map and Slice Concurrency Safety and Parameter Passing
Xueersi Online School Tech Team
Xueersi Online School Tech Team
Dec 6, 2019 · Fundamentals

Understanding Go Slice Internals: Structure, Initialization, Append, Slicing, Copy, and Parameter Passing

This article explains the internal representation of Go slices, how they are created and initialized, the mechanics of append and capacity growth, slicing behavior, deep‑copy using the copy function, and whether slices are passed by value or reference, all illustrated with source code and assembly excerpts.

CopyGoappend
0 likes · 24 min read
Understanding Go Slice Internals: Structure, Initialization, Append, Slicing, Copy, and Parameter Passing
Didi Tech
Didi Tech
Apr 18, 2019 · Backend Development

Deep Dive into Go Slices: Creation, Internals, and Append Mechanics

The article explains Go slices as three‑field descriptors pointing to an underlying array, details creation methods, shows the low‑level runtime representation and assembly for make, describes how append triggers growslice with capacity‑doubling or ~25 % growth and alignment, and clarifies sharing, nil slices, and passing semantics.

GoMemory Managementappend
0 likes · 28 min read
Deep Dive into Go Slices: Creation, Internals, and Append Mechanics
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Jan 3, 2017 · Fundamentals

Unlock Go’s Slice Secrets: Structure, Memory, and Best Practices

This article explains Go's slice data structure, how slices are represented in memory, common pitfalls with value passing, slicing, expanding, and provides practical examples of functions like copy, append, and differences between make and new for slices.

Data StructuresGobackend
0 likes · 10 min read
Unlock Go’s Slice Secrets: Structure, Memory, and Best Practices