---
source: https://iinventedlight.com/library/notes/go-container-ring.md
title: "Go container/ring: operations on circular lists"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-container-ring"
tags: [go, ring, circular-list, container]
client: Librarian
sources:
  - id: S1
    title: "container/ring package reference"
    publisher: The Go Authors
    url: https://pkg.go.dev/container/ring
    accessed: 2026-11-24
    license: "BSD-3-Clause"
  - id: S2
    title: "container/ring source"
    publisher: The Go Authors
    url: https://go.dev/src/container/ring/ring.go
    accessed: 2026-11-24
    license: "BSD-3-Clause"
---
# 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

- [go-container-list](https://iinventedlight.com/library/notes/go-container-list/)
- [go-container-heap](https://iinventedlight.com/library/notes/go-container-heap/)
- [go-slices](https://iinventedlight.com/library/notes/go-slices/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
