aboutsummaryrefslogtreecommitdiff
path: root/tests/shared_test.go
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 15:23:04 +0200
committerSandro Jäckel <sandro.jaeckel@sap.com>2022-10-28 12:55:16 +0200
commit8b38a040830109f19550e7329b82ec5caf76b321 (patch)
tree13ecc54219914102f69fb59e005a836a88f78f5c /tests/shared_test.go
parent4f67f4c0a59a850321b37a154efc9bde60539ca8 (diff)
downloadgo-schwift-8b38a040830109f19550e7329b82ec5caf76b321.tar.gz
Fix linting errors
Diffstat (limited to 'tests/shared_test.go')
-rw-r--r--tests/shared_test.go16
1 files changed, 6 insertions, 10 deletions
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)