Declare option not options
This commit is contained in:
@@ -16,12 +16,18 @@ type options struct {
|
||||
transport transport.Transport
|
||||
}
|
||||
|
||||
type Options func(*options)
|
||||
type Option func(*options)
|
||||
|
||||
var (
|
||||
DefaultClient Client = NewRpcClient()
|
||||
)
|
||||
|
||||
func Transport(t transport.Transport) Option {
|
||||
return func(o *options) {
|
||||
o.transport = t
|
||||
}
|
||||
}
|
||||
|
||||
func Call(request Request, response interface{}) error {
|
||||
return DefaultClient.Call(request, response)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ func (r *RpcClient) NewJsonRequest(service, method string, request interface{})
|
||||
return newRpcRequest(service, method, request, "application/json")
|
||||
}
|
||||
|
||||
func NewRpcClient(opt ...Options) *RpcClient {
|
||||
func NewRpcClient(opt ...Option) *RpcClient {
|
||||
var opts options
|
||||
|
||||
for _, o := range opt {
|
||||
|
||||
Reference in New Issue
Block a user