init
This commit is contained in:
commit
f7443bbab9
30 changed files with 271 additions and 0 deletions
BIN
fetch/fetch
Executable file
BIN
fetch/fetch
Executable file
Binary file not shown.
25
fetch/main.go
Normal file
25
fetch/main.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
for _, url := range os.Args[1:] {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "fetch: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "fetch: reading %s: %v\n", url, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("%s", b)
|
||||
}
|
||||
}
|
0
fetch/main.go~
Normal file
0
fetch/main.go~
Normal file
Reference in a new issue