Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove blank when all parameters are not used and Add ErrJobFuncNotFound #1879

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/backoff/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (b *backoff) Close() {
b.wg.Wait()
}

func Metrics(_ context.Context) map[string]int64 {
func Metrics(context.Context) map[string]int64 {
mu.RLock()
defer mu.RUnlock()

Expand Down
2 changes: 1 addition & 1 deletion internal/circuitbreaker/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (bm *breakerManager) Do(ctx context.Context, key string, fn func(ctx contex
return val, nil
}

func Metrics(_ context.Context) map[string]map[State]int64 {
func Metrics(context.Context) map[string]map[State]int64 {
mu.RLock()
defer mu.RUnlock()

Expand Down
4 changes: 2 additions & 2 deletions internal/client/v1/client/vald/vald.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,11 @@ func (c *client) StreamGetObject(ctx context.Context, opts ...grpc.CallOption) (
return res, nil
}

func (*singleClient) Start(_ context.Context) (<-chan error, error) {
func (*singleClient) Start(context.Context) (<-chan error, error) {
return nil, nil
}

func (*singleClient) Stop(_ context.Context) error {
func (*singleClient) Stop(context.Context) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions internal/db/kvs/redis/redis_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (m *MockRedis) TxPipeline() redis.Pipeliner {
return m.TxPipelineFunc()
}

func (m *MockRedis) Ping(_ context.Context) *StatusCmd {
func (m *MockRedis) Ping(context.Context) *StatusCmd {
return m.PingFunc()
}

Expand Down Expand Up @@ -62,15 +62,15 @@ func (*dummyHook) BeforeProcess(ctx context.Context, _ Cmder) (context.Context,
return ctx, nil
}

func (*dummyHook) AfterProcess(_ context.Context, _ Cmder) error {
func (*dummyHook) AfterProcess(context.Context, Cmder) error {
return nil
}

func (*dummyHook) BeforeProcessPipeline(ctx context.Context, _ []Cmder) (context.Context, error) {
return ctx, nil
}

func (*dummyHook) AfterProcessPipeline(_ context.Context, _ []Cmder) error {
func (*dummyHook) AfterProcessPipeline(context.Context, []Cmder) error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions internal/db/nosql/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (c *client) Open(ctx context.Context) (err error) {
}

// Close closes the session to cassandra.
func (c *client) Close(_ context.Context) error {
func (c *client) Close(context.Context) error {
c.session.Close()
return nil
}
Expand Down Expand Up @@ -379,7 +379,7 @@ func WrapErrorWithKeys(err error, keys ...string) error {
case ErrNotFound:
return errors.ErrCassandraNotFound(keys...)
case ErrUnavailable:
return errors.ErrCassandraUnavailable()
return errors.ErrCassandraUnavailable
case ErrUnsupported:
return err
case ErrTooManyStmts:
Expand Down
2 changes: 1 addition & 1 deletion internal/db/nosql/cassandra/cassandra_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ func (dm *DialerMock) DialContext(ctx context.Context, network, addr string) (ne
func (dm *DialerMock) GetDialer() func(ctx context.Context, network, addr string) (net.Conn, error) {
return dm.DialContextFunc
}
func (*DialerMock) StartDialerCache(_ context.Context) {}
func (*DialerMock) StartDialerCache(context.Context) {}
2 changes: 1 addition & 1 deletion internal/db/nosql/cassandra/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,7 @@ func TestWrapErrorWithKeys(t *testing.T) {
err: ErrUnavailable,
},
want: want{
err: errors.ErrCassandraUnavailable(),
err: errors.ErrCassandraUnavailable,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion internal/db/rdb/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (m *mySQLClient) Ping(ctx context.Context) (err error) {

// Close closes the connection of MySQL database.
// If the connection is already closed or closing connection is failed, it returns error.
func (m *mySQLClient) Close(_ context.Context) (err error) {
func (m *mySQLClient) Close(context.Context) (err error) {
if m.session == nil {
err = errors.ErrMySQLSessionNil
m.errorLog(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/db/storage/blob/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func New(opts ...Option) (b blob.Bucket, err error) {
}

// Open does nothing. Always returns nil.
func (*client) Open(_ context.Context) (err error) {
func (*client) Open(context.Context) (err error) {
return nil
}

Expand Down
50 changes: 23 additions & 27 deletions internal/errors/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,26 @@ var (
return Errorf("consistetncy type %q is not defined", consistency)
}

// NewErrCassandraNotFoundIdentity represents a function to generate an error of cassandra entry not found.
NewErrCassandraNotFoundIdentity = func() error {
return &ErrCassandraNotFoundIdentity{
err: New("cassandra entry not found"),
}
// ErrCassandraNotFoundIdentity generates an error of cassandra entry not found.
ErrCassandraNotFoundIdentity = &CassandraNotFoundIdentityError{
err: New("cassandra entry not found"),
}

// NewErrCassandraUnavailableIdentity represents a function to generate an error of cassandra unavailable.
NewErrCassandraUnavailableIdentity = func() error {
return &ErrCassandraUnavailableIdentity{
err: New("cassandra unavailable"),
}
// ErrCassandraUnavailableIdentity generates an error of cassandra unavailable.
ErrCassandraUnavailableIdentity = &CassandraUnavailableIdentityError{
err: New("cassandra unavailable"),
}

// ErrCassandraUnavailable represents NewErrCassandraUnavailableIdentity.
ErrCassandraUnavailable = NewErrCassandraUnavailableIdentity
ErrCassandraUnavailable = ErrCassandraUnavailableIdentity

// ErrCassandraNotFound represents a function to generate an error of cassandra keys not found.
ErrCassandraNotFound = func(keys ...string) error {
switch {
case len(keys) == 1:
return Wrapf(NewErrCassandraNotFoundIdentity(), "cassandra key '%s' not found", keys[0])
return Wrapf(ErrCassandraNotFoundIdentity, "cassandra key '%s' not found", keys[0])
case len(keys) > 1:
return Wrapf(NewErrCassandraNotFoundIdentity(), "cassandra keys '%v' not found", keys)
return Wrapf(ErrCassandraNotFoundIdentity, "cassandra keys '%v' not found", keys)
default:
return nil
}
Expand Down Expand Up @@ -76,44 +72,44 @@ var (
}
)

// ErrCassandraNotFoundIdentity represents custom error for cassandra not found.
type ErrCassandraNotFoundIdentity struct {
// CassandraNotFoundIdentityError represents custom error for cassandra not found.
type CassandraNotFoundIdentityError struct {
err error
}

// Error returns string of internal error.
func (e *ErrCassandraNotFoundIdentity) Error() string {
func (e *CassandraNotFoundIdentityError) Error() string {
return e.err.Error()
}

// Unwrap returns an internal error.
func (e *ErrCassandraNotFoundIdentity) Unwrap() error {
func (e *CassandraNotFoundIdentityError) Unwrap() error {
return e.err
}

// IsErrCassandraNotFound reports whether any error in err's chain matches ErrCassandraNotFound.
func IsErrCassandraNotFound(err error) bool {
target := new(ErrCassandraNotFoundIdentity)
// IsCassandraNotFoundError reports whether any error in err's chain matches CassandraNotFoundError.
func IsCassandraNotFoundError(err error) bool {
target := new(CassandraNotFoundIdentityError)
return As(err, &target)
}

// ErrCassandraUnavailableIdentity represents custom error for cassandra unavailable.
type ErrCassandraUnavailableIdentity struct {
// CassandraUnavailableIdentityError represents custom error for cassandra unavailable.
type CassandraUnavailableIdentityError struct {
err error
}

// Error returns string of internal error.
func (e *ErrCassandraUnavailableIdentity) Error() string {
func (e *CassandraUnavailableIdentityError) Error() string {
return e.err.Error()
}

// Unwrap returns internal error.
func (e *ErrCassandraUnavailableIdentity) Unwrap() error {
func (e *CassandraUnavailableIdentityError) Unwrap() error {
return e.err
}

// IsErrCassandraUnavailable reports whether any error in err's chain matches ErrCassandraUnavailableIdentity.
func IsErrCassandraUnavailable(err error) bool {
target := new(ErrCassandraUnavailableIdentity)
// IsCassandraUnavailableError reports whether any error in err's chain matches CassandraUnavailableIdentityError.
func IsCassandraUnavailableError(err error) bool {
target := new(CassandraUnavailableIdentityError)
return As(err, &target)
}
Loading