finished 1.7 - 1.9 as well as wrote fetch.go
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"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()
|
||||
_, err = io.Copy(os.Stdout, resp.Body)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user