func GeocodingReverse(location Location) ([]Address, error) {
	var addresses []Address
	url := getURLGeocodingReverse(location, "")
	results, err := httpRequest(url)
	if err != nil {
		log.Println(err)
		return addresses, err
	}
	addresses = convertResultsToAddress(results)
	return addresses, nil
}
GeocodingReverse function is used to convert a Location structure
to an Address structure
package geocoder
import (
	"encoding/json"
	"errors"
	"log"
	"net/http"
	"strconv"
	"strings"
	"github.com/kelvins/geocoder/structs"
)
var ApiKey string
const (
	geocodeApiUrl = "https://maps.googleapis.com/maps/api/geocode/json?"
)
type Address struct {
	Street           string
	Number           int
	Neighborhood     string
	District         string
	City             string
	County           string
	State            string
	Country          string
	PostalCode       string
	FormattedAddress string
	Types            string
}
type Location struct {
	Latitude  float64
	Longitude float64
}
func (address *Address) FormatAddress() string {
	var content []string
	if address.Number > 0 {
		content = append(content, strconv.Itoa(address.Number))
	}
	content = append(content, address.Street)
	content = append(content, address.Neighborhood)
	content = append(content, address.District)
	content = append(content, address.PostalCode)
	content = append(content, address.City)
	content = append(content, address.County)
	content = append(content, address.State)
	content = append(content, address.Country)
	var formattedAddress string
	for _, value := range content {
		if value != "" {
			if formattedAddress != "" {
				formattedAddress += ", "
			}
			formattedAddress += value
		}
	}
	return formattedAddress
}
func httpRequest(url string) (structs.Results, error) {
	var results structs.Results
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return results, err
	}
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		return results, err
	}
	defer resp.Body.Close()
	err = json.NewDecoder(resp.Body).Decode(&results)
	if err != nil {
		return results, err
	}
	if strings.ToUpper(results.Status) != "OK" {
		switch strings.ToUpper(results.Status) {
		case "ZERO_RESULTS":
			err = errors.New("No results found.")
			break
		case "OVER_QUERY_LIMIT":
			err = errors.New("You are over your quota.")
			break
		case "REQUEST_DENIED":
			err = errors.New("Your request was denied.")
			break
		case "INVALID_REQUEST":
			err = errors.New("Probably the query is missing.")
			break
		case "UNKNOWN_ERROR":
			err = errors.New("Server error. Please, try again.")
			break
		default:
			break
		}
	}
	return results, err
}
func Geocoding(address Address) (Location, error) {
	var location Location
	formattedAddress := address.FormatAddress()
	formattedAddress = strings.Replace(formattedAddress, " ", "+", -1)
	url := geocodeApiUrl + "address=" + formattedAddress
	if ApiKey != "" {
		url += "&key=" + ApiKey
	}
	results, err := httpRequest(url)
	if err != nil {
		log.Println(err)
		return location, err
	}
	location.Latitude = results.Results[0].Geometry.Location.Lat
	location.Longitude = results.Results[0].Geometry.Location.Lng
	return location, nil
}
func convertResultsToAddress(results structs.Results) (addresses []Address) {
	for index := 0; index < len(results.Results); index++ {
		var address Address
		for _, component := range results.Results[index].AddressComponents {
			for _, types := range component.Types {
				switch types {
				case "route":
					address.Street = component.LongName
					break
				case "street_number":
					address.Number, _ = strconv.Atoi(component.LongName)
					break
				case "neighborhood":
					address.Neighborhood = component.LongName
					break
				case "sublocality":
					address.District = component.LongName
					break
				case "sublocality_level_1":
					address.District = component.LongName
					break
				case "locality":
					address.City = component.LongName
					break
				case "administrative_area_level_3":
					address.City = component.LongName
					break
				case "administrative_area_level_2":
					address.County = component.LongName
					break
				case "administrative_area_level_1":
					address.State = component.LongName
					break
				case "country":
					address.Country = component.LongName
					break
				case "postal_code":
					address.PostalCode = component.LongName
					break
				default:
					break
				}
			}
		}
		address.FormattedAddress = results.Results[index].FormattedAddress
		address.Types = results.Results[index].Types[0]
		addresses = append(addresses, address)
	}
	return
}