lensm
Go assembly and source viewer
A Go tool that shows your compiled code and the assembly instructions it generates side by side, so you can see exactly what the CPU will run.
Lensm is a tool for Go programmers who want to look at the low-level machine instructions that the Go compiler produces from their code. When you write a program in Go, the compiler translates your readable code into assembly: a much lower-level set of instructions that the CPU actually executes. Seeing both side by side can help developers understand what the computer is doing, spot performance issues, or check that the compiler is optimizing things as expected.
You install the tool with a single Go command, open it, and point it at a compiled binary on your machine. You provide a text pattern matching a function name, and lensm displays that function's source code alongside the corresponding assembly instructions. A screenshot in the repository shows the side-by-side view.
The watch flag lets the tool monitor the binary and refresh automatically whenever it is recompiled, which is practical during an active development session. The README notes that the binary must be compiled on your own machine, because lensm needs access to the original source files to display them next to the assembly output.
For most people, this tool is only relevant if you are working in Go and have a reason to inspect low-level compiler output. The author wrote a blog post (linked in the README) explaining the motivation and how the core functionality works.
The README is very brief and does not describe the full interface or all available options, so the tool may have capabilities beyond what is covered here.
Where it fits
- Inspect assembly output for a specific Go function to spot unexpected compiler behavior.
- Watch a binary update in real time as you recompile, to track how code changes affect generated instructions.
- Check whether the Go compiler is applying optimizations like inlining or loop unrolling to your hot paths.