From 8b38a040830109f19550e7329b82ec5caf76b321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 26 Oct 2022 15:23:04 +0200 Subject: Fix linting errors --- tests/shared_test.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'tests/shared_test.go') diff --git a/tests/shared_test.go b/tests/shared_test.go index 54934ff..d6271a6 100644 --- a/tests/shared_test.go +++ b/tests/shared_test.go @@ -19,7 +19,7 @@ package tests import ( - "crypto/md5" + "crypto/md5" //nolint:gosec // Etag uses md5 "crypto/rand" "encoding/hex" "math" @@ -107,7 +107,7 @@ func testWithContainer(t *testing.T, testCode func(c *schwift.Container)) { //////////////////////////////////////////////////////////////////////////////// func etagOf(buf []byte) string { - hash := md5.Sum(buf) + hash := md5.Sum(buf) //nolint:gosec // Etag uses md5 return hex.EncodeToString(hash[:]) } @@ -124,7 +124,7 @@ func getRandomName() string { return hex.EncodeToString(buf[:]) } -func getRandomSegmentContent(length int) string { +func getRandomSegmentContent(length int) string { //nolint:unparam buf := make([]byte, length/2) _, err := rand.Read(buf) if err != nil { @@ -177,17 +177,13 @@ func expectString(t *testing.T, actual, expected string) { } } -func expectError(t *testing.T, actual error, expected string) (ok bool) { +func expectError(t *testing.T, actual error, expected string) { t.Helper() if actual == nil { t.Errorf("expected error %q, got no error\n", expected) - return false - } - if expected != actual.Error() { + } else if expected != actual.Error() { t.Errorf("expected error %q, got %q instead\n", expected, actual.Error()) - return false } - return true } func expectSuccess(t *testing.T, actual error) (ok bool) { @@ -199,7 +195,7 @@ func expectSuccess(t *testing.T, actual error) (ok bool) { return true } -func expectHeaders(t *testing.T, actual map[string]string, expected map[string]string) { +func expectHeaders(t *testing.T, actual, expected map[string]string) { t.Helper() reported := make(map[string]bool) -- cgit v1.2.3