cmd/zlint-gtld-update/main.go
func getTLDData() ([]util.GTLDPeriod, error) {
	respBody, err := getData(ICANN_TLDS)
	if err != nil {
		return nil, fmt.Errorf("error getting ICANN TLD list : %s", err)
	}
	tlds := strings.Split(string(respBody), "\n")

	var results []util.GTLDPeriod
	for _, tld := range tlds {
		// Skip empty lines and the header comment line
		if strings.TrimSpace(tld) == "" || strings.HasPrefix(tld, "#") {
			continue
		}
		results = append(results, util.GTLDPeriod{
			GTLD: strings.ToLower(tld),
			// The TLD list doesn't indicate when any of the TLDs were delegated so
			// assume these TLDs were all delegated at the same time as "com".
			DelegationDate: "1985-01-01",
		})
	}
	return results, nil
}
func getTLDData() ([]util.GTLDPeriod, error) {
	respBody, err := getData(ICANN_TLDS)
	if err != nil {
		return nil, fmt.Errorf("error getting ICANN TLD list : %s", err)
	}
	tlds := strings.Split(string(respBody), "\n")

	var results []util.GTLDPeriod
	for _, tld := range tlds {
		// Skip empty lines and the header comment line
		if strings.TrimSpace(tld) == "" || strings.HasPrefix(tld, "#") {
			continue
		}
		results = append(results, util.GTLDPeriod{
			GTLD: strings.ToLower(tld),
			// The TLD list doesn't indicate when any of the TLDs were delegated so
			// assume these TLDs were all delegated at the same time as "com".
			DelegationDate: "1985-01-01",
		})
	}
	return results, nil
}
// getTLDData fetches the ICANN_TLDS list and uses the information to build
// and return a list of util.GTLDPeriod objects (or an error if anything fails).
// Since this data source only contains TLD names and not any information
// about delegation/removal all of the returned `util.GTLDPeriod` objects will
// have the DelegationDate "1985-01-01" (matching the `.com` delegation date)
// and no RemovalDate.