mirror of
https://github.com/minio/minio.git
synced 2025-11-25 20:16:10 -05:00
notifiers: Stop using url.Parse in validating address format. (#4011)
url.Parse() wrongly parses an address of format "address:port" which is fixed in go1.8. This inculcates a breaking change on our end. We should fix this wrong usage everywhere so that migrating to go1.8 eventually becomes smoother.
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
||||
@@ -47,6 +48,12 @@ func (k *kafkaNotify) Validate() error {
|
||||
if len(k.Brokers) == 0 {
|
||||
return errors.New("No broker specified")
|
||||
}
|
||||
// Validate all specified brokers.
|
||||
for _, brokerAddr := range k.Brokers {
|
||||
if _, _, err := net.SplitHostPort(brokerAddr); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user