How can I get the country code number by passing the number in golang by using this library: https://godoc.org/github.com/nyaruka/phonenumbers?
The answer which I was looking is how to get the country code by passing the phone number only, this is the solution which is working perfectly.
num, err := phonenumbers.Parse("+123456789", "")
if err != nil {
fmt.Println(err.Error())
}
regionNumber := phonenumbers.GetRegionCodeForNumber(num)
countryCode := phonenumbers.GetCountryCodeForRegion(regionNumber)
fmt.Println(countryCode)
Thank you Yacacov for the hint ;)