Beispiel #1
0
func initUrls(year, startMonth, endMonth int) {
	for month := startMonth; month <= endMonth; month++ {
		feedUrl := strings.Replace(BASE_URL, "{year}", strconv.Itoa(year), 1)
		feedUrl = strings.Replace(feedUrl, "{month}", helpers.LeftPad2Len(strconv.Itoa(month), "0", 2), 1)

		//urls.PushBack(feedUrl)
		urls = append(urls, feedUrl)
	}
}
Beispiel #2
0
func genUrls(year, startMonth, endMonth int) <-chan string {
	out := make(chan string)

	go func() {
		for month := startMonth; month <= endMonth; month++ {

			feedUrl := strings.Replace(BASE_URL, "{year}", strconv.Itoa(year), 1)
			feedUrl = strings.Replace(feedUrl, "{month}", helpers.LeftPad2Len(strconv.Itoa(month), "0", 2), 1)

			out <- feedUrl
		}
		close(out)
	}()

	return out
}