Find out compiler version of a go binary


If you have a binary that was produced by a golang compiler, and you want to find out which version of the compiler was used, you can use use the C debugger gdb as follows:

echo "p 'runtime.buildVersion'" \
  | gdb /path/to/binary 2>/dev/null \
  | awk '/go[0-9]/ {print $NF}'