[#199] sdk/client: Correct linter's remarks

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-16 18:10:51 +03:00 committed by Alex Vanin
parent 00ce980d82
commit 0620a3b1eb
7 changed files with 76 additions and 43 deletions

View file

@ -1,6 +1,8 @@
package client
import (
"fmt"
"github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/token"
v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting"
@ -17,7 +19,7 @@ type (
apply(*callOptions)
}
ClientOption interface {
Option interface {
apply(*clientOptions)
}
@ -54,6 +56,12 @@ type (
}
)
type errOptionsLack string
func (e errOptionsLack) Error() string {
return fmt.Sprintf("lack of sdk client options to create %s client", string(e))
}
func (c Client) defaultCallOptions() callOptions {
return callOptions{
ttl: 2,
@ -149,13 +157,13 @@ func newFuncClientOption(f func(option *clientOptions)) *funcClientOption {
}
}
func WithAddress(addr string) ClientOption {
func WithAddress(addr string) Option {
return newFuncClientOption(func(option *clientOptions) {
option.addr = addr
})
}
func WithGRPCConnection(grpcConn *grpc.ClientConn) ClientOption {
func WithGRPCConnection(grpcConn *grpc.ClientConn) Option {
return newFuncClientOption(func(option *clientOptions) {
option.grpcOpts.conn = grpcConn
})