28 lines
354 B
Go
28 lines
354 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
//"net"
|
||
|
"net/http"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
if len(os.Args) != 2 {
|
||
|
fmt.Println("Usage: ./http-get http://bulgariu.xyz")
|
||
|
os.Exit(0)
|
||
|
}
|
||
|
request, err := http.Get(os.Args[1])
|
||
|
fmt.Println(os.Args[1])
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
os.Exit(2)
|
||
|
}
|
||
|
fmt.Println(request)
|
||
|
|
||
|
}
|
||
|
|
||
|
// func handleConn(conn net.Conn) {
|
||
|
//
|
||
|
// }
|