update file

This commit is contained in:
Victor Vieux 2014-12-10 21:28:45 +00:00
parent 2e6c8cc00c
commit f04af68d3f
2 changed files with 11 additions and 4 deletions

View File

@ -30,7 +30,7 @@ func Register(scheme string, initFunc InitFunc) error {
if _, exists := discoveries[scheme]; exists {
return fmt.Errorf("scheme already registered %s", scheme)
}
fmt.Printf("Registering %q discovery service", scheme)
log.Debugf("Registering %q discovery service", scheme)
discoveries[scheme] = initFunc
return nil
@ -43,8 +43,8 @@ func New(rawurl string) (DiscoveryService, error) {
}
if initFct, exists := discoveries[url.Scheme]; exists {
log.Debugf("Initialising %q discovery service with %q", url.Scheme, url.Host)
return initFct(url.Host)
log.Debugf("Initialising %q discovery service with %q", url.Scheme, url.Host+url.Path)
return initFct(url.Host + url.Path)
}
return nil, ErrNotSupported

View File

@ -27,7 +27,14 @@ func (s FileDiscoveryService) Fetch() ([]string, error) {
return nil, err
}
return strings.Split(string(data), "\n"), nil
lines := []string{}
for _, line := range strings.Split(string(data), "\n") {
if line != "" {
lines = append(lines, line)
}
}
return lines, nil
}
func (s FileDiscoveryService) Watch(heartbeat int) <-chan time.Time {