Golang binary search implementation

package main

import (
	"fmt"
	"math"
)

func binarySearch(arr []int, val int) int {
	var first = 0
	var last = len(arr) - 1
	for first <= last {
		var midpoint = int(math.Floor(float64((first + last) / 2)))
		if arr[midpoint] == val {
			return midpoint
		}
		if val < arr[midpoint] {
			last = midpoint - 1
		} else {
			first = midpoint + 1
		}
	}
	return -1
}

func main() {
	arr := []int{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39}
	fmt.Println(binarySearch(arr, 35))
}