Move global vars to the top of the src file: conventions
This commit is contained in:
parent
0ec1b840fd
commit
04a5d884da
@ -5,6 +5,15 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
DefaultRegistry = NewRegistry()
|
||||||
|
|
||||||
|
// Not found error when GetService is called
|
||||||
|
ErrNotFound = errors.New("service not found")
|
||||||
|
// Watcher stopped error when watcher is stopped
|
||||||
|
ErrWatcherStopped = errors.New("watcher stopped")
|
||||||
|
)
|
||||||
|
|
||||||
// The registry provides an interface for service discovery
|
// The registry provides an interface for service discovery
|
||||||
// and an abstraction over varying implementations
|
// and an abstraction over varying implementations
|
||||||
// {consul, etcd, zookeeper, ...}
|
// {consul, etcd, zookeeper, ...}
|
||||||
@ -25,15 +34,6 @@ type RegisterOption func(*RegisterOptions)
|
|||||||
|
|
||||||
type WatchOption func(*WatchOptions)
|
type WatchOption func(*WatchOptions)
|
||||||
|
|
||||||
var (
|
|
||||||
DefaultRegistry = NewRegistry()
|
|
||||||
|
|
||||||
// Not found error when GetService is called
|
|
||||||
ErrNotFound = errors.New("service not found")
|
|
||||||
// Watcher stopped error when watcher is stopped
|
|
||||||
ErrWatcherStopped = errors.New("watcher stopped")
|
|
||||||
)
|
|
||||||
|
|
||||||
// Register a service node. Additionally supply options such as TTL.
|
// Register a service node. Additionally supply options such as TTL.
|
||||||
func Register(s *Service, opts ...RegisterOption) error {
|
func Register(s *Service, opts ...RegisterOption) error {
|
||||||
return DefaultRegistry.Register(s, opts...)
|
return DefaultRegistry.Register(s, opts...)
|
||||||
|
Loading…
Reference in New Issue
Block a user