fix golint issues in zrpc (#531)

This commit is contained in:
Kevin Wan
2021-03-01 23:52:44 +08:00
committed by GitHub
parent dd393351cc
commit 51de0d0620
29 changed files with 108 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import (
)
type (
// ServerOption defines the method to customize a rpcServerOptions.
ServerOption func(options *rpcServerOptions)
rpcServerOptions struct {
@@ -26,6 +27,7 @@ func init() {
InitLogger()
}
// NewRpcServer returns a Server.
func NewRpcServer(address string, opts ...ServerOption) Server {
var options rpcServerOptions
for _, opt := range opts {
@@ -76,6 +78,7 @@ func (s *rpcServer) Start(register RegisterFn) error {
return server.Serve(lis)
}
// WithMetrics returns a func that sets metrics to a Server.
func WithMetrics(metrics *stat.Metrics) ServerOption {
return func(options *rpcServerOptions) {
options.metrics = metrics