mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Unexport URI.SetHost
This commit is contained in:
parent
6f256e0edb
commit
ac83bf4422
3 changed files with 7 additions and 7 deletions
6
uri.go
6
uri.go
|
|
@ -69,7 +69,7 @@ func (u URIs) HostPortStrings() []string {
|
|||
// NewURIFromHostPort returns a URI with specified host and port.
|
||||
func NewURIFromHostPort(host string, port uint16) (*URI, error) {
|
||||
uri := defaultURI()
|
||||
err := uri.SetHost(host)
|
||||
err := uri.setHost(host)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "setting uri host")
|
||||
}
|
||||
|
|
@ -92,8 +92,8 @@ func (u *URI) SetScheme(scheme string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SetHost sets the host of this URI.
|
||||
func (u *URI) SetHost(host string) error {
|
||||
// setHost sets the host of this URI.
|
||||
func (u *URI) setHost(host string) error {
|
||||
m := hostRegexp.FindStringSubmatch(host)
|
||||
if m == nil {
|
||||
return errors.New("invalid host")
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ func TestSetScheme(t *testing.T) {
|
|||
func TestSetHost(t *testing.T) {
|
||||
uri := defaultURI()
|
||||
target := "10.20.30.40"
|
||||
err := uri.SetHost(target)
|
||||
err := uri.setHost(target)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ func TestSetInvalidScheme(t *testing.T) {
|
|||
|
||||
func TestSetInvalidHost(t *testing.T) {
|
||||
uri := defaultURI()
|
||||
err := uri.SetHost("index?.pilosa.com")
|
||||
err := uri.setHost("index?.pilosa.com")
|
||||
if err == nil {
|
||||
t.Fatalf("Should have failed")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,14 +57,14 @@ func NewTestCluster(n int) *cluster {
|
|||
func NewTestURI(scheme, host string, port uint16) URI {
|
||||
uri := defaultURI()
|
||||
uri.SetScheme(scheme)
|
||||
uri.SetHost(host)
|
||||
uri.setHost(host)
|
||||
uri.SetPort(port)
|
||||
return *uri
|
||||
}
|
||||
|
||||
func NewTestURIFromHostPort(host string, port uint16) URI {
|
||||
uri := defaultURI()
|
||||
uri.SetHost(host)
|
||||
uri.setHost(host)
|
||||
uri.SetPort(port)
|
||||
return *uri
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue