Ok; my favorite awk one-liner I found somewhere and learnt by heart is for extracting "blocks of text between some starting pattern/line and some ending pattern/line"; most often, that would be "functions with particular name, with their whole body". Brace yourselves:
awk '/^func Test/{p=1}; p; /^}/{p=0}'
EXPLANATIONFirst of all, this is 3 separate "commands", separated by ';'. In order:
/^func Test/ {p=1}
— if line matches regexp '^func Test' (i.e., starts with "func Test"), then set variable p to 1 (a.k.a. "True"). p
— equivalent to any of: p { print }
p { print $0 }
{ if (p) { print $0 } }
meaning: if variable p is true-ish (in case of this script, if p==1), then print current line (if action is not specified after a condition, then it's by default {print}). /^}/ {p=0}
— you may have guessed already now: stop printing after encountering end of function (line starting with '}').