Fix style

This commit is contained in:
Fedor Korotkiy 2020-03-07 22:15:30 +03:00
parent dac5b0b7f8
commit 8f06f2db4e
2 changed files with 12 additions and 12 deletions

View file

@ -9,14 +9,14 @@ import (
)
var (
_ error = (*ApiError)(nil)
_ error = (*APIError)(nil)
_ error = (*ConflictError)(nil)
_ error = (*AuthError)(nil)
_ error = (*NotFoundError)(nil)
)
type (
ApiError struct {
APIError struct {
Method string
Err error
@ -35,11 +35,11 @@ type (
}
)
func (a *ApiError) Error() string {
func (a *APIError) Error() string {
return fmt.Sprintf("api: %q error: %v", a.Method, a.Err)
}
func (a *ApiError) Unwrap() error {
func (a *APIError) Unwrap() error {
return a.Err
}

View file

@ -28,14 +28,14 @@ var (
errUpdate = errors.New("update error")
errGetAuth = &kvapi.ApiError{Method: "get", Err: &kvapi.AuthError{Msg: "token expired"}}
errSetAuth = &kvapi.ApiError{Method: "set", Err: &kvapi.AuthError{Msg: "token expired"}}
errGetAuth = &kvapi.APIError{Method: "get", Err: &kvapi.AuthError{Msg: "token expired"}}
errSetAuth = &kvapi.APIError{Method: "set", Err: &kvapi.AuthError{Msg: "token expired"}}
errGetNoKey = &kvapi.ApiError{Method: "get", Err: &kvapi.NotFoundError{Key: K0}}
errSetNoKey = &kvapi.ApiError{Method: "set", Err: &kvapi.NotFoundError{Key: K0}}
errGetNoKey = &kvapi.APIError{Method: "get", Err: &kvapi.NotFoundError{Key: K0}}
errSetNoKey = &kvapi.APIError{Method: "set", Err: &kvapi.NotFoundError{Key: K0}}
errGetTemporary = &kvapi.ApiError{Method: "get", Err: errors.New("unavailable")}
errSetTemporary = &kvapi.ApiError{Method: "set", Err: errors.New("unavailable")}
errGetTemporary = &kvapi.APIError{Method: "get", Err: errors.New("unavailable")}
errSetTemporary = &kvapi.APIError{Method: "set", Err: errors.New("unavailable")}
)
type setMatcher struct {
@ -262,7 +262,7 @@ func TestRetrySetConflict(t *testing.T) {
c.EXPECT().
Set(SetRequest(K0, V1, UUID0)).
Return(nil, &kvapi.ApiError{Method: "set", Err: &kvapi.ConflictError{ExpectedVersion: UUID1, ProvidedVersion: UUID0}}),
Return(nil, &kvapi.APIError{Method: "set", Err: &kvapi.ConflictError{ExpectedVersion: UUID1, ProvidedVersion: UUID0}}),
c.EXPECT().
Get(&kvapi.GetRequest{Key: K0}).
@ -296,7 +296,7 @@ func TestRetrySetFalseConflict(t *testing.T) {
// second Set returns conflict with ExpectedVersion == OldVersion from previous request.
c.EXPECT().
Set(SetRequest(K0, V1, UUID0)).
Return(nil, &kvapi.ApiError{Method: "set", Err: conflictErr}),
Return(nil, &kvapi.APIError{Method: "set", Err: conflictErr}),
)
require.NoError(t, retryupdate.UpdateValue(c, K0, updateFn))