Skip to content

Commit 5990156

Browse files
committed
Fixup golint for s3 signer
1 parent d8ccbac commit 5990156

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

service/s3/internal/customizations/process_arn_resource.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ func buildS3ObjectLambdaAccessPointRequest(ctx context.Context, options accesspo
413413
}
414414

415415
func buildMultiRegionAccessPointsRequest(ctx context.Context, options accesspointOptions) (context.Context, error) {
416-
const s3_global_label = "s3-global."
417-
const accesspoint_label = "accesspoint."
416+
const s3GlobalLabel = "s3-global."
417+
const accesspointLabel = "accesspoint."
418418

419419
tv := options.resource
420420
req := options.request
@@ -456,7 +456,7 @@ func buildMultiRegionAccessPointsRequest(ctx context.Context, options accesspoin
456456
return ctx, fmt.Errorf("Error determining dns suffix from arn partition, %w", err)
457457
}
458458
// set url as per partition
459-
endpoint.URL = scheme[0] + "://" + s3_global_label + dnsSuffix
459+
endpoint.URL = scheme[0] + "://" + s3GlobalLabel + dnsSuffix
460460

461461
// assign resolved endpoint url to request url
462462
req.URL, err = url.Parse(endpoint.URL)
@@ -465,7 +465,7 @@ func buildMultiRegionAccessPointsRequest(ctx context.Context, options accesspoin
465465
}
466466

467467
// build access point host prefix
468-
accessPointHostPrefix := tv.AccessPointName + "." + accesspoint_label
468+
accessPointHostPrefix := tv.AccessPointName + "." + accesspointLabel
469469

470470
// add host prefix to url
471471
req.URL.Host = accessPointHostPrefix + req.URL.Host

service/s3/internal/customizations/signer_wrapper.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package customizations
33
import (
44
"context"
55
"fmt"
6+
67
"github.com/aws/aws-sdk-go-v2/aws"
78
v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
89
"github.com/aws/aws-sdk-go-v2/service/s3/internal/v4a"
@@ -110,10 +111,10 @@ func (s *SignHTTPRequestMiddleware) HandleFinalize(ctx context.Context, in middl
110111
// present, this provided middleware will be swapped. Otherwise the middleware will be added at the tail of the
111112
// finalize step.
112113
func RegisterSigningMiddleware(stack *middleware.Stack, signingMiddleware *SignHTTPRequestMiddleware) (err error) {
113-
const signingId = "Signing"
114-
_, present := stack.Finalize.Get(signingId)
114+
const signedID = "Signing"
115+
_, present := stack.Finalize.Get(signedID)
115116
if present {
116-
_, err = stack.Finalize.Swap(signingId, signingMiddleware)
117+
_, err = stack.Finalize.Swap(signedID, signingMiddleware)
117118
} else {
118119
err = stack.Finalize.Add(signingMiddleware, middleware.After)
119120
}
@@ -201,10 +202,10 @@ func (p *PresignHTTPRequestMiddleware) HandleFinalize(
201202
// present, this provided middleware will be swapped. Otherwise the middleware will be added at the tail of the
202203
// finalize step.
203204
func RegisterPreSigningMiddleware(stack *middleware.Stack, signingMiddleware *PresignHTTPRequestMiddleware) (err error) {
204-
const signingId = "PresignHTTPRequest"
205-
_, present := stack.Finalize.Get(signingId)
205+
const signedID = "PresignHTTPRequest"
206+
_, present := stack.Finalize.Get(signedID)
206207
if present {
207-
_, err = stack.Finalize.Swap(signingId, signingMiddleware)
208+
_, err = stack.Finalize.Swap(signedID, signingMiddleware)
208209
} else {
209210
err = stack.Finalize.Add(signingMiddleware, middleware.After)
210211
}

service/s3/internal/v4a/credentials.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ func (s *SymmetricCredentialAdaptor) retrieveFromSymmetricProvider(ctx context.C
134134
return credentials, nil
135135
}
136136

137+
// CredentialsProvider is the interface for a provider to retrieve credentials
138+
// to sign requests with.
137139
type CredentialsProvider interface {
138140
RetrievePrivateKey(context.Context) (Credentials, error)
139141
}

service/s3/internal/v4a/middleware.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ func hasCredentialProvider(p CredentialsProvider) bool {
9494
// present, this provided middleware will be swapped. Otherwise the middleware will be added at the tail of the
9595
// finalize step.
9696
func RegisterSigningMiddleware(stack *middleware.Stack, signingMiddleware *SignHTTPRequestMiddleware) (err error) {
97-
const signingId = "Signing"
98-
_, present := stack.Finalize.Get(signingId)
97+
const signedID = "Signing"
98+
_, present := stack.Finalize.Get(signedID)
9999
if present {
100-
_, err = stack.Finalize.Swap(signingId, signingMiddleware)
100+
_, err = stack.Finalize.Swap(signedID, signingMiddleware)
101101
} else {
102102
err = stack.Finalize.Add(signingMiddleware, middleware.After)
103103
}

service/s3/internal/v4a/v4a_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func TestPresignHTTP(t *testing.T) {
122122
query.Set("X-Amz-Expires", "18000")
123123
req.URL.RawQuery = query.Encode()
124124

125-
signedUrl, _, err := signer.PresignHTTP(context.Background(), key, req, EmptyStringSHA256, "dynamodb", []string{"us-east-1"}, time.Unix(0, 0))
125+
signedURL, _, err := signer.PresignHTTP(context.Background(), key, req, EmptyStringSHA256, "dynamodb", []string{"us-east-1"}, time.Unix(0, 0))
126126
if err != nil {
127127
t.Fatalf("expected no error, got %v", err)
128128
}
@@ -134,7 +134,7 @@ func TestPresignHTTP(t *testing.T) {
134134
expectedStrToSignHash := "d7ffbd2fab644384c056957e6ac38de4ae68246764b5f5df171b3824153b6397"
135135
expectedTarget := "prefix.Operation"
136136

137-
signedReq, err := url.Parse(signedUrl)
137+
signedReq, err := url.Parse(signedURL)
138138
if err != nil {
139139
t.Fatalf("expected no error, got %v", err)
140140
}

0 commit comments

Comments
 (0)