Added error to return values in some functions
This commit is contained in:
@@ -5,10 +5,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ParseAddr(addr string) (string, int) {
|
||||
func ParseAddr(addr string) (string, int, error) {
|
||||
p := strings.Split(addr, ":")
|
||||
fHost := p[0]
|
||||
fPort, _ := strconv.Atoi(p[1])
|
||||
fPort, err := strconv.Atoi(p[1])
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return fHost, fPort
|
||||
return fHost, fPort, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user