Golang libphonenumber

Ili*_*ici -7 go libphonenumber

如何使用此库通过在 golang 中传递号码来获取国家/地区代码号码: https: //godoc.org/github.com/nyaruka/phonenumbers

Ili*_*ici 9

我正在寻找的答案是如何通过仅传递电话号码来获取国家/地区代码,这是完美运行的解决方案。

num, err := phonenumbers.Parse("+123456789", "")

if err != nil {
    fmt.Println(err.Error())
}

regionNumber := phonenumbers.GetRegionCodeForNumber(num)
countryCode := phonenumbers.GetCountryCodeForRegion(regionNumber)
fmt.Println(countryCode)
Run Code Online (Sandbox Code Playgroud)

谢谢雅卡科夫的提示;)