MCPcopy Index your code
hub / github.com/akutz/go-interface-values

github.com/akutz/go-interface-values @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
62 symbols 95 edges 21 files 38 documented · 61%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go interface values

This repository deep dives Go interface values, what they are, how they work, and when storing a value in a Go interface allocates memory on the heap.

  • Labs: a step-by-step walkthrough of the topic
  • FAQ: answers to frequently asked questions
  • Links: links to related reference material
  • Thanks: it takes a community
  • Appendix: in-repo reference material

Labs

  1. Prerequisites: how to get from here to there
  2. Interface values: whatever you do, do not call it "boxing"
  3. Escape analysis: to malloc or not to malloc
  4. Missing mallocs: there's a heap of missing memory
  5. Lessons learned: key takeaways

FAQ

What does the Q suffix for instructions like MOVQ and LEAQ mean?

Please refer to this answer from the assembly section in the appendix.

What is the x86 assembly instruction CALL actually calling?

Please refer to this answer from the assembly section in the appendix.

Where is the CALL instruction in ARM assembly?

Please refer to this answer from the assembly section in the appendix.

What is the hack directory and the files inside of it?

The hack directory is a convention I picked up from working on Kubernetes and projects related to Kuberentes. The directory contains scripts useful to the project, but not a core piece of the project itself. For example:

Links

Thanks

  • Many thanks to reddit user nikandfor for their response to my post on this topic. Without that initial work, I am not sure this repository would exist today.
  • My gratitude to Crypto Jones from Gopher Slack for keeping me honest about "boxing." :smiley:
  • My colleague Michael Gasch who spent a lot of time proofreading this repository. Hear that y'all? Any mistakes you find? Totally Michael's fault! :smiley:
  • Andrew Williams, another co-worker, who did not judge me when he helpfully explained cache lines.
  • The first person who offered to help me dig into the assembly, Kevin Grittner!
  • Several of my colleagues who directed me to a Trie structure for the repository's bespoke test framework:
  • Michal Jankowski
  • Zhanghe Liu
  • Yiyi Zhou
  • Mayank Bhatt
  • Arunesh Pandey

Appendix

  • Assembly: reference section for go asm

Core symbols most depended-on inside this repo

_print
called by 12
hack/gen.py
get_asm_op_link
called by 4
hack/asm2md.py
noZedZed
called by 2
hack/b2md.py
go_fmt
called by 2
hack/gen.py
get_go_func_link
called by 2
hack/asm2md.py
Login
called by 2
docs/03-escape-analysis/examples/ex1/main.go
validateID
called by 2
docs/03-escape-analysis/examples/ex2/main.go
twoDecimalFloat
called by 1
hack/b2md.py

Shape

Function 60
Struct 2

Languages

Go82%
Python18%

Modules by API surface

tests/lem/lem_escape_test.go17 symbols
tests/lem/lem_leak_test.go9 symbols
tests/lem/lem_noescape_test.go4 symbols
hack/gen.py4 symbols
hack/asm2md.py4 symbols
tests/mem/mem_test.go3 symbols
tests/lem/lem_move_test.go3 symbols
hack/b2md.py3 symbols
docs/03-escape-analysis/examples/ex3/main.go2 symbols
docs/03-escape-analysis/examples/ex2/main.go2 symbols
docs/03-escape-analysis/examples/ex1/main.go2 symbols
tests/mem/bench_test.go1 symbols

For agents

$ claude mcp add go-interface-values \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page