nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: google/go-cloud
Pull request #3465 (2024-08-13 18:18:40)

aws/all: Change the default for AWS URLs from V1 to V2.

vangent: Fixed #3459.

Patch:
diff --git a/aws/aws.go b/aws/aws.go
index 55dc3864..21d4ec5a 100644
--- a/aws/aws.go
+++ b/aws/aws.go
@@ -148,15 +148,14 @@ func NewSessionFromURLParams(q url.Values) (*session.Session, url.Values, error)
 //
 // "awssdk=v1" will force V1.
 // "awssdk=v2" will force V2.
-// No "awssdk" parameter (or any other value) will return the default, currently V1.
-// Note that the default may change in the future.
+// No "awssdk" parameter (or any other value) will return the default, currently V2.
 func UseV2(q url.Values) bool {
 	if values, ok := q["awssdk"]; ok {
-		if values[0] == "v2" || values[0] == "V2" {
-			return true
+		if values[0] == "v1" || values[0] == "V1" {
+			return false
 		}
 	}
-	return false
+	return true
 }
 
 // NewDefaultV2Config returns a aws.Config for AWS SDK v2, using the default options.


Test patch:
diff --git a/aws/aws_test.go b/aws/aws_test.go
index 3a3d602d..5d04dae7 100644
--- a/aws/aws_test.go
+++ b/aws/aws_test.go
@@ -108,14 +108,17 @@ func TestUseV2(t *testing.T) {
 		{
 			name:  "No overrides",
 			query: url.Values{},
+			want:  true,
 		},
 		{
 			name:  "unused param",
 			query: url.Values{"foo": {"bar"}},
+			want:  true,
 		},
 		{
 			name:  "force v1",
 			query: url.Values{"awssdk": {"v1"}},
+			want:  false,
 		},
 		{
 			name:  "force v1 cap",
diff --git a/blob/s3blob/s3blob_test.go b/blob/s3blob/s3blob_test.go
index d23d1a4c..f5a81267 100644
--- a/blob/s3blob/s3blob_test.go
+++ b/blob/s3blob/s3blob_test.go
@@ -469,9 +469,9 @@ func TestOpenBucketFromURL(t *testing.T) {
 		// OK, setting region.
 		{"s3://mybucket?region=us-west1", false},
 		// OK, setting profile.
-		{"s3://mybucket?profile=main", false},
+		{"s3://mybucket?awssdk=v1&profile=main", false},
 		// OK, setting both profile and region.
-		{"s3://mybucket?profile=main&region=us-west-1", false},
+		{"s3://mybucket?awssdk=v1&profile=main&region=us-west-1", false},
 		// OK, use V2.
 		{"s3://mybucket?awssdk=v2", false},
 		// OK, use KMS Server Side Encryption