There is lots of go that is copy pasted,especially in the scanMacro() switch statement. Try to find a way to make it more concise and readable.