You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: geohash.go
    path of file: ./repos/godis/lib/geohash
    
    the code of the file until where you have to start completion: package geohash

import (
	"encoding/base32"
	"encoding/binary"
)

var bits = []ui
    
func encode0(latitude, longitude float64, bitSize uint) ([]byte, [2][2]float64) {
	box := [2][2]float64{
		{-180, 180}, // lng
		{-90, 90},   // lat
	}
	pos := [2]float64{longitude, latitude}
	hashLen := bitSize >> 3
	if bitSize&7 > 0 {
		hashLen++
	}
	hash := make([]byte, hashLen)
	var precision uint = 0
	for precision < bitSize {
		for direction, val := range pos {
			mid := (box[direction][0] + box[direction][1]) / 2
			if val < mid {
				box[direction][1] = mid
			} else {
				box[direction][0] = mid
				hash[precision>>3] |= 1 << (7 - precision&7)
			}
			precision++
			if precision == bitSize {
				break
			}
		}
	}

	return hash, box
}