in phonenumbers.go [3321:3371]
func init() {
// load our regions
regionMap, err := loadIntStringArrayMap(gen.RegionData)
if err != nil {
panic(err)
}
countryCodeToRegion = regionMap.Map
// then our metadata
err = loadMetadataFromFile("US", 1)
if err != nil {
panic(err)
}
for eKey, regionCodes := range countryCodeToRegion {
// We can assume that if the county calling code maps to the
// non-geo entity region code then that's the only region code
// it maps to.
if len(regionCodes) == 1 && REGION_CODE_FOR_NON_GEO_ENTITY == regionCodes[0] {
// This is the subset of all country codes that map to the
// non-geo entity region code.
countryCodesForNonGeographicalRegion[eKey] = true
} else {
// The supported regions set does not include the "001"
// non-geo entity region code.
for _, val := range regionCodes {
supportedRegions[val] = true
}
}
supportedCallingCodes[eKey] = true
}
// If the non-geo entity still got added to the set of supported
// regions it must be because there are entries that list the non-geo
// entity alongside normal regions (which is wrong). If we discover
// this, remove the non-geo entity from the set of supported regions
// and log (or not log).
delete(supportedRegions, REGION_CODE_FOR_NON_GEO_ENTITY)
for _, val := range countryCodeToRegion[NANPA_COUNTRY_CODE] {
writeToNanpaRegions(val, struct{}{})
}
// Create our sync.Onces for each of our languages for carriers
for lang := range gen.CarrierData {
carrierOnces[lang] = &sync.Once{}
}
for lang := range gen.GeocodingData {
geocodingOnces[lang] = &sync.Once{}
}
}