From 2b918d585e650cc8f2391992b720acd5c3f6ff6e Mon Sep 17 00:00:00 2001 From: Ben McClelland Date: Wed, 15 Apr 2026 10:29:40 -0700 Subject: [PATCH] chore: fix spellings and unused function args No logic changes, just janitorial cleanup --- auth/bucket_policy.go | 2 +- backend/common.go | 6 +++--- backend/posix/posix.go | 2 +- s3api/controllers/base_test.go | 2 +- s3api/utils/presign-auth-reader.go | 2 +- s3api/utils/utils.go | 2 +- tests/integration/AbortMultipartUpload.go | 2 +- tests/integration/CompleteMultipartUpload.go | 4 ++-- tests/integration/group-tests.go | 4 ++-- tests/integration/utils.go | 2 +- tests/rest_scripts/command/openSSLRequest.go | 7 ++++--- tests/rest_scripts/command/s3Request.go | 5 +++-- 12 files changed, 21 insertions(+), 19 deletions(-) diff --git a/auth/bucket_policy.go b/auth/bucket_policy.go index 60ee8fbb..717c5e13 100644 --- a/auth/bucket_policy.go +++ b/auth/bucket_policy.go @@ -64,7 +64,7 @@ func (bp *BucketPolicy) UnmarshalJSON(data []byte) error { } if tmp.Version == nil { - // bucket policy version should defualt to '2008-10-17' + // bucket policy version should default to '2008-10-17' bp.Version = PolicyVersion2008 } else { bp.Version = *tmp.Version diff --git a/backend/common.go b/backend/common.go index 06d1a430..83c30b93 100644 --- a/backend/common.go +++ b/backend/common.go @@ -93,8 +93,8 @@ var ( // ParseObjectRange parses input range header and returns startoffset, length, isValid // and error. If no endoffset specified, then length is set to the object size -// for invalid inputs, it returns no error, but isValid=false -// `InvalidRange` error is returnd, only if startoffset is greater than the object size +// for invalid inputs, it returns isValid=false and error=nil +// `InvalidRange` error is returned only if startoffset is greater than the object size func ParseObjectRange(size int64, acceptRange string) (int64, int64, bool, error) { // Return full object (invalid range, no error) if header empty if acceptRange == "" { @@ -498,7 +498,7 @@ type PreConditions struct { // - if-none-match // - if-modified-since // - if-unmodified-since -// if-match and if-none-match are ETag comparisions +// if-match and if-none-match are ETag comparisons // if-modified-since and if-unmodified-since are last modifed time comparisons func EvaluatePreconditions(etag string, modTime time.Time, preconditions PreConditions) error { if preconditions.IfMatch == nil && preconditions.IfNoneMatch == nil && preconditions.IfModSince == nil && preconditions.IfUnmodeSince == nil { diff --git a/backend/posix/posix.go b/backend/posix/posix.go index 9cfd5fef..bf4c9fa6 100644 --- a/backend/posix/posix.go +++ b/backend/posix/posix.go @@ -2242,7 +2242,7 @@ func (p *Posix) loadObjectMetadata(f *os.File, bucket, object string) map[string if len(result) != 0 { err = p.storeObjectMetadata(f, bucket, object, result) if err == nil { - // if it succeded to store the metadata as a json + // if it succeeded to store the metadata as a json // object in user.metadata, cleanup the legacy X-Amz-Meta. // attributes for _, attr := range legacyAttrs { diff --git a/s3api/controllers/base_test.go b/s3api/controllers/base_test.go index 4b7a583a..73dd82ec 100644 --- a/s3api/controllers/base_test.go +++ b/s3api/controllers/base_test.go @@ -302,7 +302,7 @@ func TestProcessController(t *testing.T) { expected expected }{ { - name: "no services successfull response", + name: "no services successful response", args: args{ svc: &Services{}, controller: func(ctx *fiber.Ctx) (*Response, error) { diff --git a/s3api/utils/presign-auth-reader.go b/s3api/utils/presign-auth-reader.go index a545be7e..be3a3fb5 100644 --- a/s3api/utils/presign-auth-reader.go +++ b/s3api/utils/presign-auth-reader.go @@ -240,7 +240,7 @@ func validateAlgorithm(algo string) error { case algoECDSA: return s3err.QueryAuthErrors.OnlyHMACSupported() default: - // all other algorithms are considerd as invalid + // all other algorithms are considered as invalid return s3err.QueryAuthErrors.UnsupportedAlgorithm() } } diff --git a/s3api/utils/utils.go b/s3api/utils/utils.go index a38adfdd..5e37bdc0 100644 --- a/s3api/utils/utils.go +++ b/s3api/utils/utils.go @@ -966,7 +966,7 @@ func ConvertToStringPtr[T any](val T) *string { return &str } -// Converst any pointer to a string pointer +// Converts any pointer to a string pointer func ConvertPtrToStringPtr[T any](val *T) *string { if val == nil { return nil diff --git a/tests/integration/AbortMultipartUpload.go b/tests/integration/AbortMultipartUpload.go index 868b920e..9616723f 100644 --- a/tests/integration/AbortMultipartUpload.go +++ b/tests/integration/AbortMultipartUpload.go @@ -210,7 +210,7 @@ func AbortMultipartUpload_if_match_initiated_time(s *S3Conf) error { {initiated, nil}, // should ignore future dates {getPtr(initiated.AddDate(1, 0, 0)), nil}, - // should fail if the initation date doesn't match + // should fail if the initiated date doesn't match {getPtr(initiated.AddDate(-1, 0, 1)), s3err.GetAPIError(s3err.ErrPreconditionFailed)}, } { err := abortMp(test.date) diff --git a/tests/integration/CompleteMultipartUpload.go b/tests/integration/CompleteMultipartUpload.go index e2483c95..fb838ef7 100644 --- a/tests/integration/CompleteMultipartUpload.go +++ b/tests/integration/CompleteMultipartUpload.go @@ -1626,8 +1626,8 @@ func CompleteMultipartUpload_invalid_part_number(s *S3Conf) error { }) } -func CompleteMultipartUpload_defualt_content_type(s *S3Conf) error { - testName := "CompleteMultipartUpload_defualt_content_type" +func CompleteMultipartUpload_default_content_type(s *S3Conf) error { + testName := "CompleteMultipartUpload_default_content_type" return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error { obj := "my-object" mp, err := createMp(s3client, bucket, obj) diff --git a/tests/integration/group-tests.go b/tests/integration/group-tests.go index 14bc0d1f..988e84c9 100644 --- a/tests/integration/group-tests.go +++ b/tests/integration/group-tests.go @@ -503,7 +503,7 @@ func TestCompleteMultipartUpload(ts *TestState) { ts.Run(CompletedMultipartUpload_non_existing_bucket) ts.Run(CompleteMultipartUpload_incorrect_part_number) ts.Run(CompleteMultipartUpload_invalid_part_number) - ts.Run(CompleteMultipartUpload_defualt_content_type) + ts.Run(CompleteMultipartUpload_default_content_type) ts.Run(CompleteMultipartUpload_invalid_ETag) ts.Run(CompleteMultipartUpload_small_upload_size) ts.Run(CompleteMultipartUpload_empty_parts) @@ -1586,7 +1586,7 @@ func GetIntTests() IntTests { "AbortMultipartUpload_if_match_initiated_time": AbortMultipartUpload_if_match_initiated_time, "CompletedMultipartUpload_non_existing_bucket": CompletedMultipartUpload_non_existing_bucket, "CompleteMultipartUpload_invalid_part_number": CompleteMultipartUpload_invalid_part_number, - "CompleteMultipartUpload_defualt_content_type": CompleteMultipartUpload_defualt_content_type, + "CompleteMultipartUpload_default_content_type": CompleteMultipartUpload_default_content_type, "CompleteMultipartUpload_invalid_ETag": CompleteMultipartUpload_invalid_ETag, "CompleteMultipartUpload_small_upload_size": CompleteMultipartUpload_small_upload_size, "CompleteMultipartUpload_empty_parts": CompleteMultipartUpload_empty_parts, diff --git a/tests/integration/utils.go b/tests/integration/utils.go index fea0ace6..3f98e7dd 100644 --- a/tests/integration/utils.go +++ b/tests/integration/utils.go @@ -1715,7 +1715,7 @@ func extractCORSHeaders(resp *http.Response) (*PreflightResult, error) { var errResp smithy.GenericAPIError err = xml.Unmarshal(body, &errResp) if err != nil { - return nil, fmt.Errorf("unmarshal respone body: %w", err) + return nil, fmt.Errorf("unmarshal response body: %w", err) } return &PreflightResult{ diff --git a/tests/rest_scripts/command/openSSLRequest.go b/tests/rest_scripts/command/openSSLRequest.go index acf5b539..0796d0e1 100644 --- a/tests/rest_scripts/command/openSSLRequest.go +++ b/tests/rest_scripts/command/openSSLRequest.go @@ -2,9 +2,10 @@ package command import ( "fmt" - "github.com/versity/versitygw/tests/rest_scripts/logger" "os" "strings" + + "github.com/versity/versitygw/tests/rest_scripts/logger" ) type OpenSSLCommand struct { @@ -64,14 +65,14 @@ func (o *OpenSSLCommand) Render() error { return fmt.Errorf("error writing to file: %w", err) } if o.Config.PayloadFile != "" || o.Config.Payload != "" { - if err = o.writePayload(file); err != nil { + if err = o.writePayload(); err != nil { return fmt.Errorf("error writing openssl payload: %w", err) } } return nil } -func (o *OpenSSLCommand) writePayload(file *os.File) error { +func (o *OpenSSLCommand) writePayload() error { if awsPayload, ok := o.payloadManager.(*PayloadStreamingAWS4HMACSHA256); ok { awsPayload.AddInitialSignatureAndSigningKey(o.signature, o.signingKey) } diff --git a/tests/rest_scripts/command/s3Request.go b/tests/rest_scripts/command/s3Request.go index a21a34c2..48b56fcf 100644 --- a/tests/rest_scripts/command/s3Request.go +++ b/tests/rest_scripts/command/s3Request.go @@ -6,11 +6,12 @@ import ( "encoding/base64" "encoding/hex" "fmt" - "github.com/versity/versitygw/tests/rest_scripts/logger" "os" "sort" "strings" "time" + + "github.com/versity/versitygw/tests/rest_scripts/logger" ) type S3Request struct { @@ -104,7 +105,7 @@ func (s *S3Request) calculateCanonicalRequestHash() error { canonicalQuery, err := s.getCanonicalQuery() if err != nil { - return fmt.Errorf("error generating canoncial query: %w", err) + return fmt.Errorf("error generating canonical query: %w", err) } canonicalRequestLines = append(canonicalRequestLines, canonicalQuery)