1 个仓库
Uses a local variable or index to capture each element's address inside a range loop, preventing all pointers from referencing the last element.
Distinct from Range-Based Loop Iteration: Distinct from Range-Based Loop Iteration: focuses on the specific Go pitfall of pointer aliasing in range loops, not general range iteration syntax.
Explore 1 awesome GitHub repository matching software engineering & architecture · Go Range Loop Pointer Aliasing. Refine with filters or upvote what's useful.
100 Go Mistakes is a reference book and code review companion that catalogues frequent Go programming anti-patterns and provides corrected implementations for each one. It covers a wide range of common pitfalls, from range loop variable capture and interface nil handling to error wrapping and map iteration randomization, helping developers recognize and avoid these issues in their own code. The project distinguishes itself by offering a structured, example-driven approach to learning idiomatic Go. It covers core design decisions such as when to use pointer versus value receivers, how to apply
Explains the common Go bug where range loop variables share a single address, causing pointer aliasing.