Asynchronous http request in golang

type HttpResp struct {
	Id   string
	Resp *http.Response
	Err  error
}

func AsyncGet(urls map[string]string) []*HttpResp {
	ch := make(chan *HttpResp)
	responses := []*HttpResp{}

	for track_id, url := range urls {

		go func(i, u string) {
			resp, err := http.Get(u)
			ch <- &HttpResp{i, resp, err}
		}(track_id, url)
	}

loop:
	for {
		select {
		case r := <-ch:
			responses = append(responses, r)
			if len(responses) == len(urls) {
				break loop
			}
		case <-time.After(50 * time.Millisecond):
			fmt.Printf(".")
		}
	}
	return responses
}

Download file from internet with Golang

package main

import "os"
import "log"
import "fmt"
import "time"
import "strconv"
import "io/ioutil"
import "net/http"
import "path/filepath"
import "crypto/rand"

func main() {
	download_link := "http://golang.org/doc/gopher/frontpage.png"
	path, err := download_file(download_link)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(path)
}

func download_file(download_link string) (string, error) {
	ext := filepath.Ext(download_link)

	dir_path, err := dir_full_path()
	if err != nil {
		return "", err
	}
	file_name := rand_str(10) + ext
	file_path := dir_path + file_name

	os.Mkdir(dir_path, 0666)

	file, err := os.Create(file_path)
	if err != nil {
		return "", err
	}
	defer file.Close()

	res, err := http.Get(download_link)
	if err != nil {
		return "", err
	}
	defer res.Body.Close()

	file_content, err := ioutil.ReadAll(res.Body)

	if err != nil {
		return "", err
	}

	// returns file size and err
	_, err = file.Write(file_content)

	if err != nil {
		return "", err
	}

	return file_path, nil
}

func dir_full_path() (string, error) {
	path, err := filepath.Abs("files")

	if err != nil {
		return "", err
	}

	t := time.Now()

	s := path +
		string(os.PathSeparator) +
		strconv.Itoa(t.Day()) +
		"_" +
		strconv.Itoa(int(t.Month())) +
		"_" +
		strconv.Itoa(t.Year()) +
		string(os.PathSeparator)

	return s, nil
}

func rand_str(n int) string {
	alphanum := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

	var bytes = make([]byte, n)
	rand.Read(bytes)
	for i, b := range bytes {
		bytes[i] = alphanum[b%byte(len(alphanum))]
	}
	return string(bytes)
}

create a list of struct in golang

type Track_list struct {
Song_name string
Song_hash string
Artist_name string
Artist_hash string
}

songs_list := []Track_list{}

for _, item := range content.Toptracks.Track {
songs_list = append(songs_list, Track_list{item.Name, item.Mbid, item.Artist.Name, item.Artist.Mbid})
}