shamrock was here just so oda could introduce him i think.
he is not getting beaten in elbaf or even in the next arc imo. Oda said shamrock was important to the end of one piece in an interview. The misunderstanding with the giants can be cleared away by gunko after she regains her mind, or one of the hk boasting.
I doubt goofy won't hurt gunko. He will for sure attack and hurt her as long as imu is inside her.
The popular speculation has been that Brook wakes gunko up and she pushes imu out of her. But the problem with that is, as we saw with Saturn, imu can just kill people who have his blessings and disobeys him.
So goofy will need to do nothing to gunko. But that's also problematic in that the last arc also ended with imu dusting a gorosei. I don't know if he'll do it in the very next arc again. Maybe gunko pushes imu out and his powers and control over her completely along with it.