Heat trace asymptotics and the Gauss–Bonnet theorem for general connections