This library helps to lookup calling code of all countries in the world
- Go get way
go get github.com/baorv/phonecode
- Glide way
glide get github.com/baorv/phonecode
package main
import (
"github.com/baorv/phonecode"
"log"
)
func main() {
// You can use custom data
// reader, err := phonecode.New("/path/to/customize.csv")
reader, err := phonecode.New()
if err != nil {
log.Panicf("Error when open reader with message: %s", err.Error())
}
record := reader.LookupPhoneCode("VN")
log.Printf("%s as calling code is: %s", record.CountryCode, record.Code)
}
Execute test suite:
go test
Contributions welcome! Please fork the repository and open a pull request with your changes.
This project is licensed under the MIT License.