The role of Lagrange multiplier in Gauss–Bonnet dark energy