*: fix golangci error-strings issues

Signed-off-by: Ivan Valdes <ivan@vald.es>
This commit is contained in:
Ivan Valdes 2023-12-21 11:52:32 -08:00
parent e5665a7ef2
commit fe03e168a3
No known key found for this signature in database
GPG Key ID: 4037D37741ED0CC5
4 changed files with 19 additions and 16 deletions

View File

@ -318,7 +318,7 @@ func TestSimpleHTTPClientDoHeaderTimeout(t *testing.T) {
} }
func TestHTTPClusterClientDo(t *testing.T) { func TestHTTPClusterClientDo(t *testing.T) {
fakeErr := errors.New("fake!") fakeErr := errors.New("fake")
fakeURL := url.URL{} fakeURL := url.URL{}
tests := []struct { tests := []struct {
client *httpClusterClient client *httpClusterClient
@ -583,11 +583,11 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
client: &multiStaticHTTPClient{ client: &multiStaticHTTPClient{
responses: []staticHTTPResponse{ responses: []staticHTTPResponse{
{ {
err: errors.New("fail!"), err: errors.New("fail"),
}, },
}, },
}, },
wantErr: errors.New("fail!"), wantErr: errors.New("fail"),
}, },
// no need to follow redirect if none given // no need to follow redirect if none given
@ -723,7 +723,9 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
}, },
}, },
}, },
//revive:disable:error-strings
wantErr: errors.New("location header not valid URL: :"), wantErr: errors.New("location header not valid URL: :"),
//revive:enable:error-strings
}, },
// fail if redirects checked way too many times // fail if redirects checked way too many times
@ -830,7 +832,7 @@ func TestHTTPClusterClientSync(t *testing.T) {
func TestHTTPClusterClientSyncFail(t *testing.T) { func TestHTTPClusterClientSyncFail(t *testing.T) {
cf := newStaticHTTPClientFactory([]staticHTTPResponse{ cf := newStaticHTTPClientFactory([]staticHTTPResponse{
{err: errors.New("fail!")}, {err: errors.New("fail")},
}) })
hc := &httpClusterClient{ hc := &httpClusterClient{
@ -886,7 +888,7 @@ func TestHTTPClusterClientAutoSyncCancelContext(t *testing.T) {
func TestHTTPClusterClientAutoSyncFail(t *testing.T) { func TestHTTPClusterClientAutoSyncFail(t *testing.T) {
cf := newStaticHTTPClientFactory([]staticHTTPResponse{ cf := newStaticHTTPClientFactory([]staticHTTPResponse{
{err: errors.New("fail!")}, {err: errors.New("fail")},
}) })
hc := &httpClusterClient{ hc := &httpClusterClient{

View File

@ -892,7 +892,7 @@ func TestHTTPWatcherNextFail(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic HTTP client failure // generic HTTP client failure
&staticHTTPClient{ &staticHTTPClient{
err: errors.New("fail!"), err: errors.New("fail"),
}, },
// unusable status code // unusable status code
@ -994,7 +994,7 @@ func TestHTTPKeysAPIWatcherAction(t *testing.T) {
} }
for i, tt := range tests { for i, tt := range tests {
testError := errors.New("fail!") testError := errors.New("fail")
kAPI := &httpKeysAPI{ kAPI := &httpKeysAPI{
client: &staticHTTPClient{err: testError}, client: &staticHTTPClient{err: testError},
} }
@ -1080,7 +1080,7 @@ func TestHTTPKeysAPISetError(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic HTTP client failure // generic HTTP client failure
&staticHTTPClient{ &staticHTTPClient{
err: errors.New("fail!"), err: errors.New("fail"),
}, },
// unusable status code // unusable status code
@ -1191,7 +1191,7 @@ func TestHTTPKeysAPIGetError(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic HTTP client failure // generic HTTP client failure
&staticHTTPClient{ &staticHTTPClient{
err: errors.New("fail!"), err: errors.New("fail"),
}, },
// unusable status code // unusable status code
@ -1310,7 +1310,7 @@ func TestHTTPKeysAPIDeleteError(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic HTTP client failure // generic HTTP client failure
&staticHTTPClient{ &staticHTTPClient{
err: errors.New("fail!"), err: errors.New("fail"),
}, },
// unusable status code // unusable status code

View File

@ -371,7 +371,7 @@ func TestHTTPMembersAPIAddError(t *testing.T) {
// generic httpClient failure // generic httpClient failure
{ {
peerURL: okPeer, peerURL: okPeer,
client: &staticHTTPClient{err: errors.New("fail!")}, client: &staticHTTPClient{err: errors.New("fail")},
}, },
// unrecognized HTTP status code // unrecognized HTTP status code
@ -456,7 +456,7 @@ func TestHTTPMembersAPIRemoveFail(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic error // generic error
&staticHTTPClient{ &staticHTTPClient{
err: errors.New("fail!"), err: errors.New("fail"),
}, },
// unexpected HTTP status code // unexpected HTTP status code
@ -509,7 +509,7 @@ func TestHTTPMembersAPIListSuccess(t *testing.T) {
func TestHTTPMembersAPIListError(t *testing.T) { func TestHTTPMembersAPIListError(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic httpClient failure // generic httpClient failure
&staticHTTPClient{err: errors.New("fail!")}, &staticHTTPClient{err: errors.New("fail")},
// unrecognized HTTP status code // unrecognized HTTP status code
&staticHTTPClient{ &staticHTTPClient{
@ -569,7 +569,7 @@ func TestHTTPMembersAPILeaderSuccess(t *testing.T) {
func TestHTTPMembersAPILeaderError(t *testing.T) { func TestHTTPMembersAPILeaderError(t *testing.T) {
tests := []httpClient{ tests := []httpClient{
// generic httpClient failure // generic httpClient failure
&staticHTTPClient{err: errors.New("fail!")}, &staticHTTPClient{err: errors.New("fail")},
// unrecognized HTTP status code // unrecognized HTTP status code
&staticHTTPClient{ &staticHTTPClient{

View File

@ -83,9 +83,10 @@ linters-settings: # please keep this alphabetized
- name: context-keys-type - name: context-keys-type
severity: error severity: error
disabled: false disabled: false
# TODO: enable the following rules
- name: error-strings - name: error-strings
disabled: true severity: error
disabled: false
# TODO: enable the following rules
- name: var-naming - name: var-naming
disabled: true disabled: true
- name: exported - name: exported