finished 1.7 - 1.9 as well as wrote fetch.go

This commit is contained in:
dm
2015-12-04 13:29:31 -08:00
parent 914dca955d
commit bbefd172c1
4 changed files with 119 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)
func main() {
if len(os.Args[1:]) < 1 {
log.Fatal("requires args")
}
for _, i := range os.Args[1:] {
resp, err := http.Get(i)
if err != nil {
log.Print(err)
continue
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Print(err)
}
fmt.Printf("%s", body)
}
}