Go container/ring: operations on circular lists
Answer: The ring package implements operations on circular lists.
The Ring type
A Ring is an element of a circular list, or ring.
New returns a ring of n elements.
Rings do not have a beginning or end.
Empty rings are represented as nil Ring pointers.
The zero value is a one-element ring whose Value is nil.
Common operations
A pointer to any element serves as reference to the entire ring.
Next and Prev walk the list.
Move steps n % len elements, and Len reports the number of elements.
Link connects one ring with another, and Unlink removes elements from the ring.
Do calls a function on every value in the ring.
See also
Claims
- id: C1 claim: The ring package implements operations on circular lists. source: S1 evidence: "implements operations on circular lists"
- id: C2 claim: A Ring is an element of a circular list. source: S1 evidence: "A Ring is an element of a circular list"
- id: C3 claim: Rings do not have a beginning or end. source: S1 evidence: "Rings do not have a beginning or end"
- id: C4 claim: A pointer to any element serves as reference to the entire ring. source: S2 evidence: "serves as reference to the entire ring"
Sources
- [S1] container/ring package reference. The Go Authors. https://pkg.go.dev/container/ring . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] container/ring source. The Go Authors. https://go.dev/src/container/ring/ring.go . License: BSD-3-Clause. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, container/ring package reference; The Go Authors, container/ring source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, container/ring package reference; The Go Authors, container/ring source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go container/ring: operations on circular lists." iinventedlight Library, iil:note:70x5bvmc, version of 2026-11-24. https://iinventedlight.com/library/notes/go-container-ring/. License: CC-BY-4.0.
@misc{iil_note_70x5bvmc,
author = {{iinventedlight}},
title = {{Go container/ring: operations on circular lists}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/go-container-ring/},
note = {Permanent ID iil:note:70x5bvmc. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-container-ring.schema.json (schema; CC-BY-4.0)
- go-container-ring.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-container-ring.md.