Skip to content

Commit 6465380

Browse files
authored
Merge pull request #1355 from bgilbert/nits
internal/resource: fix minor nits
2 parents bd6aa78 + 52f6381 commit 6465380

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

internal/resource/url.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ func (f *Fetcher) parseARN(arnURL string) (string, string, string, error) {
567567
urlSplit := strings.Split(arnURL, "/")
568568

569569
// Determine if the ARN is for an access point or a bucket.
570-
var bucket, key string
571570
if strings.HasPrefix(s3arn.Resource, "accesspoint/") {
572571
// urlSplit must consist of arn, name of accesspoint, and key
573572
if len(urlSplit) < 3 {
@@ -578,8 +577,8 @@ func (f *Fetcher) parseARN(arnURL string) (string, string, string, error) {
578577
// you provide the access point ARN in place of the bucket name.
579578
// For more information about access point ARNs, see Using access points
580579
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html
581-
bucket = strings.Join(urlSplit[:2], "/")
582-
key = strings.Join(urlSplit[2:], "/")
580+
bucket := strings.Join(urlSplit[:2], "/")
581+
key := strings.Join(urlSplit[2:], "/")
583582
return bucket, key, s3arn.Region, nil
584583
}
585584
// urlSplit must consist of name of bucket and key
@@ -591,7 +590,7 @@ func (f *Fetcher) parseARN(arnURL string) (string, string, string, error) {
591590
// If specified, the key is part of the Relative ID which has the format "bucket-name/object-key" according to
592591
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html
593592
bucketUrlSplit := strings.Split(urlSplit[0], ":")
594-
bucket = bucketUrlSplit[len(bucketUrlSplit)-1]
595-
key = strings.Join(urlSplit[1:], "/")
593+
bucket := bucketUrlSplit[len(bucketUrlSplit)-1]
594+
key := strings.Join(urlSplit[1:], "/")
596595
return bucket, key, "", nil
597596
}

internal/resource/url_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func TestParseARN(t *testing.T) {
298298
for i, test := range tests {
299299
bucket, key, region, err := f.parseARN(test.in.url)
300300
if !reflect.DeepEqual(test.out.err, err) {
301-
t.Errorf("#%d: fetching URL: expected error %+v, got %+v", i, test.out.err, err)
301+
t.Errorf("#%d: expected error %+v, got %+v", i, test.out.err, err)
302302
continue
303303
}
304304
if test.out.err == nil && !reflect.DeepEqual(test.out.bucket, bucket) {

0 commit comments

Comments
 (0)