Flux pinning mechanism of graphene oxide (GO) doped MgB2 has been systematically studied. In the framework of the collective pinning theory, a B-T phase diagram has been constructed. By adjusting the GO doping level, the pinning mechanism in MgB2 transformed from transition temperature fluctuation induced pinning, δTc pinning, to mean free path fluctuation induced pinning, δl pinning, is observed. Furthermore, in terms of the thermally activated flux flow model, the pinning potential in high field (B > 5 T) is enhanced by GO doping. The unique feature of GO is the significant improvement of both low field Jc and high field Jc.