File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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) {
382382}
383383
384384var (
385- host = flag .String ("host" , "localhost:8000" , "Serving host" )
385+ protocol = "http"
386+ address = "localhost:8000"
387+ host = flag .String ("host" , address , "Serving host" )
386388)
387389
388390func main () {
389391 flag .Parse ()
390- fmt .Println ("Serving Go+ tutorial at" , * host )
392+ fmt .Printf ("Serving Go+ tutorial at %s://%s \n " , protocol , * host )
391393 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+ }
393398}
394399
395400// -----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments