cmd/matchbox: fix -address parsing when built with Go 1.8

* 1.8 changed the behavior of url.Parse so it is no longer
appropriate for parsing values like 0.0.0.0:8080
* Pass the address directly to http.ListenAndServe which gives
reasonable errors when bad values are given
This commit is contained in:
Dalton Hubble
2017-03-08 01:45:30 -08:00
parent 3ff11fad17
commit 0d1beeb632

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"net"
"net/http"
"net/url"
"os"
"github.com/Sirupsen/logrus"
@@ -79,9 +78,6 @@ func main() {
}
// validate arguments
if url, err := url.Parse(flags.address); err != nil || url.String() == "" {
log.Fatal("A valid HTTP listen address is required")
}
if finfo, err := os.Stat(flags.dataPath); err != nil || !finfo.IsDir() {
log.Fatal("A valid -data-path is required")
}