Answer the question
In order to leave comments, you need to log in
Golang how to get http server start error for example if port is busy?
subject the docs say that ListenAndServe always returns a non-nil error. but I did not find the values of the errors of the operation of the server itself there, I found only errors in servicing requests.
Answer the question
In order to leave comments, you need to log in
Everything returns successfully from ListenAndServe
package main
import (
"fmt"
"net/http"
)
func main() {
err := http.ListenAndServe(":8090", nil)
fmt.Println("Error creating http server: ", err)
}
$ go run main.go
Error creating http server: listen tcp :8090: bind: address already in use
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question