← All notes

Go container/list: a doubly linked list

Answer: Package list implements a doubly linked list.

Walking the list

Front returns the first Element.

Next returns the next Element, and Prev returns the previous Element.

Walk from Front while the Element is not nil.

Updating the list

PushBack adds a value and returns the new Element.

PushFront does the same at the front of the list.

InsertBefore and InsertAfter place a value next to a mark Element.

Remove takes an Element and returns its value.

Init initializes a List.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, container/list package reference; Go, container/list 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: Go, container/list package reference; Go, container/list source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:daj6n4x2

iinventedlight. 2026. "Go container/list: a doubly linked list." iinventedlight Library, iil:note:daj6n4x2, version of 2026-11-24. https://iinventedlight.com/library/notes/go-container-list/. License: CC-BY-4.0.

@misc{iil_note_daj6n4x2,
  author = {{iinventedlight}},
  title = {{Go container/list: a doubly linked list}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/go-container-list/},
  note = {Permanent ID iil:note:daj6n4x2. License: CC-BY-4.0.},
}

Markdown

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.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-container-list.md.