Access country data and metadata
masterYou can access country constants directly (e.g., countries.Japan) or use lookup functions like ByName and ByNumeric.
Once you have a country object, you can retrieve various ISO and regional data using method calls. The package also provides an .Info() method that returns a struct containing most of these fields for easier access to non-method properties.
// Accessing via constants and methods
countryJapan := countries.Japan
fmt.Printf("Name: %v\n", countryJapan) // Japan
fmt.Printf("Alpha-2: %v\n", countryJapan.Alpha2()) // JP
fmt.Printf("Capital: %v\n", countryJapan.Capital()) // Tokyo
// Accessing via Info() struct
japanInfo := countries.Japan.Info()
fmt.Printf("Name: %v\n", japanInfo.Name) // Japan
fmt.Printf("Alpha-2: %v\n", japanInfo.Alpha2) // JP