Go Binary Gap
func binaryGap(n int) int {
	trimmed := strings.Trim(strconv.FormatInt(int64(n), 2), "0")

	gap := 0
	for _, zeroes := range strings.Split(trimmed, "1") {
		if len(zeroes) > gap {
			gap = len(zeroes)
		}
	}

	return gap
}

This turns the number into binary, ignores zeroes outside the edges, and finds the longest run of zeroes between 1s.