More linting fun

This commit is contained in:
Asim
2016-04-06 18:03:27 +01:00
parent 2f50c74f41
commit bfe20d81d0
12 changed files with 33 additions and 38 deletions

View File

@@ -293,7 +293,6 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
// no error, we send the special EOS error
return lastStreamResponseError
}
return nil
}
for i := len(server.hdlrWrappers); i > 0; i-- {

View File

@@ -94,12 +94,12 @@ var (
DefaultServer Server = newRpcServer()
)
// Returns config options for the default service
// DefaultOptions returns config options for the default service
func DefaultOptions() Options {
return DefaultServer.Options()
}
// Initialises the default server with options passed in
// Init initialises the default server with options passed in
func Init(opt ...Option) {
if DefaultServer == nil {
DefaultServer = newRpcServer(opt...)
@@ -107,18 +107,18 @@ func Init(opt ...Option) {
DefaultServer.Init(opt...)
}
// Returns a new server with options passed in
// NewServer returns a new server with options passed in
func NewServer(opt ...Option) Server {
return newRpcServer(opt...)
}
// Creates a new subscriber interface with the given topic
// NewSubscriber creates a new subscriber interface with the given topic
// and handler using the default server
func NewSubscriber(topic string, h interface{}, opts ...SubscriberOption) Subscriber {
return DefaultServer.NewSubscriber(topic, h, opts...)
}
// Creates a new handler interface using the default server
// NewHandler creates a new handler interface using the default server
// Handlers are required to be a public object with public
// methods. Call to a service method such as Foo.Bar expects
// the type:
@@ -132,29 +132,29 @@ func NewHandler(h interface{}, opts ...HandlerOption) Handler {
return DefaultServer.NewHandler(h, opts...)
}
// Registers a handler interface with the default server to
// Handle registers a handler interface with the default server to
// handle inbound requests
func Handle(h Handler) error {
return DefaultServer.Handle(h)
}
// Registers a subscriber interface with the default server
// Subscribe registers a subscriber interface with the default server
// which subscribes to specified topic with the broker
func Subscribe(s Subscriber) error {
return DefaultServer.Subscribe(s)
}
// Registers the default server with the discovery system
// Register registers the default server with the discovery system
func Register() error {
return DefaultServer.Register()
}
// Deregisters the default server from the discovery system
// Deregister deregisters the default server from the discovery system
func Deregister() error {
return DefaultServer.Deregister()
}
// Blocking run starts the default server and waits for a kill
// Run starts the default server and waits for a kill
// signal before exiting. Also registers/deregisters the server
func Run() error {
if err := Start(); err != nil {
@@ -176,19 +176,20 @@ func Run() error {
return Stop()
}
// Starts the default server
// Start starts the default server
func Start() error {
config := DefaultServer.Options()
log.Printf("Starting server %s id %s", config.Name, config.Id)
return DefaultServer.Start()
}
// Stops the default server
// Stop stops the default server
func Stop() error {
log.Printf("Stopping server")
return DefaultServer.Stop()
}
// String returns name of Server implementation
func String() string {
return DefaultServer.String()
}

View File

@@ -122,8 +122,7 @@ func validateSubscriber(sub Subscriber) error {
return fmt.Errorf("subscriber %v argument type not exported: %v", name, argType)
}
if typ.NumOut() != 1 {
return fmt.Errorf(
"subscriber %v.%v has wrong number of outs: %v require signature %s",
return fmt.Errorf("subscriber %v has wrong number of outs: %v require signature %s",
name, typ.NumOut(), subSig)
}
if returnType := typ.Out(0); returnType != typeOfError {