Run go tool asm -S file.s to view the assembly source and generated machine code.
Use the -S flag with go tool asm to print the assembly source alongside the generated machine code. Run the command below, replacing file.s with your assembly source file path.
go tool asm -S file.s
The output displays the instruction sequence, line numbers, and the corresponding hex encoding for each instruction.
Reading Go assembly output shows you exactly how your Go assembly code translates into machine instructions. It helps you verify that the compiler is generating the code you expect by displaying both the human-readable assembly and the raw binary data side-by-side. Think of it as a translator that shows you both the original sentence and the translated version.