2020-02-13 11:45:11 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-06-05 17:36:34 +00:00
|
|
|
"io"
|
2020-02-13 11:45:11 +00:00
|
|
|
"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)
|
|
|
|
}
|
2024-06-05 17:36:34 +00:00
|
|
|
b, err := io.ReadAll(resp.Body)
|
2020-02-13 11:45:11 +00:00
|
|
|
resp.Body.Close()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(os.Stderr, "fetch: reading %s: %v\n", url, err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
fmt.Printf("%s", b)
|
|
|
|
}
|
|
|
|
}
|