Skip to content

Instantly share code, notes, and snippets.

@aalemayhu
Forked from anonymous/GoCourseDay.go
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalemayhu/8847732c1747b0cf1fb5 to your computer and use it in GitHub Desktop.
Save aalemayhu/8847732c1747b0cf1fb5 to your computer and use it in GitHub Desktop.
// http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay1.pdf
package main
import (
"fmt"
"log"
"os/exec"
"strconv"
s "strings"
)
func main() {
fmt.Println("Downloading pdfs")
url_pattern := "http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay$1.pdf"
for i := 1; i < 4; i++ {
number := strconv.Itoa(i)
download_url := s.Replace(url_pattern, "$1", number, -1)
log.Printf("starting with %s", download_url)
cmd := exec.Command("wget", download_url)
err := cmd.Start()
if err != nil {
log.Fatal(err)
}
err = cmd.Wait()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment