File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -382,14 +382,19 @@ func handle(root string) func(w http.ResponseWriter, req *http.Request) {
382
382
}
383
383
384
384
var (
385
- host = flag .String ("host" , "localhost:8000" , "Serving host" )
385
+ protocol = "http"
386
+ address = "localhost:8000"
387
+ host = flag .String ("host" , address , "Serving host" )
386
388
)
387
389
388
390
func main () {
389
391
flag .Parse ()
390
- fmt .Println ("Serving Go+ tutorial at" , * host )
392
+ fmt .Printf ("Serving Go+ tutorial at %s://%s \n " , protocol , * host )
391
393
http .HandleFunc ("/" , handle ("." ))
392
- http .ListenAndServe (* host , nil )
394
+ err := http .ListenAndServe (* host , nil )
395
+ if err != nil {
396
+ log .Fatalf ("Failed to start server at %s://%s.\n Error: %s." , protocol , * host , err )
397
+ }
393
398
}
394
399
395
400
// -----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments