nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: knative/pkg
Pull request #1559 (2020-07-27 07:52:14)

Add helpers for float pointers.
As per title, to be able to replace the respective workarounds in code. I got inspired by deprecated protobuf packages mostly, that ship the same wrappers.

/assign @julz 

knative-prow-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/1559#" title="Author self-approved">markusthoemmes</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fpkg).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/knative/pkg/blob/master/OWNERS)~~ [markusthoemmes]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/ptr/ptr.go b/ptr/ptr.go
index a3bfef85c..6d5eeaab6 100644
--- a/ptr/ptr.go
+++ b/ptr/ptr.go
@@ -30,6 +30,18 @@ func Int64(i int64) *int64 {
 	return &i
 }
 
+// Float32 is a helper for turning floats into pointers for use in
+// API types that want *float32.
+func Float32(f float32) *float32 {
+	return &f
+}
+
+// Float64 is a helper for turning floats into pointers for use in
+// API types that want *float64.
+func Float64(f float64) *float64 {
+	return &f
+}
+
 // Bool is a helper for turning bools into pointers for use in
 // API types that want *bool.
 func Bool(b bool) *bool {


Test patch:
diff --git a/ptr/ptr_test.go b/ptr/ptr_test.go
index 3555edf2e..f4be88bbc 100644
--- a/ptr/ptr_test.go
+++ b/ptr/ptr_test.go
@@ -21,9 +21,8 @@ import (
 	"time"
 )
 
-const want = 55
-
 func TestInt32(t *testing.T) {
+	const want = 55
 	gotPtr := Int32(want)
 	if want != *gotPtr {
 		t.Errorf("Int32() = &%v, wanted %v", *gotPtr, want)
@@ -31,12 +30,29 @@ func TestInt32(t *testing.T) {
 }
 
 func TestInt64(t *testing.T) {
+	const want = 55
 	gotPtr := Int64(want)
 	if want != *gotPtr {
 		t.Errorf("Int64() = &%v, wanted %v", *gotPtr, want)
 	}
 }
 
+func TestFloat32(t *testing.T) {
+	const want = 1.25
+	gotPtr := Float32(want)
+	if want != *gotPtr {
+		t.Errorf("Float32() = &%v, wanted %v", *gotPtr, want)
+	}
+}
+
+func TestFloat64(t *testing.T) {
+	const want = 1.25
+	gotPtr := Float64(want)
+	if want != *gotPtr {
+		t.Errorf("Float64() = &%v, wanted %v", *gotPtr, want)
+	}
+}
+
 func TestBool(t *testing.T) {
 	const want = true
 	gotPtr := Bool(want)
Repository: knative/pkg
Pull request #1698 (2020-09-10 14:00:01)

Enhance error message on failure to update _example.
We still see users frequently struggle with this and the error message seemingly doesn't help them. This gives a more explicit description of what the user can do to fix the situation.

/assign @mattmoor @vagababov 

knative-prow-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/1698#" title="Author self-approved">markusthoemmes</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fpkg).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[webhook/OWNERS](https://github.com/knative/pkg/blob/master/webhook/OWNERS)~~ [markusthoemmes]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/webhook/configmaps/configmaps.go b/webhook/configmaps/configmaps.go
index c2e7da0e6..bf1f3b84c 100644
--- a/webhook/configmaps/configmaps.go
+++ b/webhook/configmaps/configmaps.go
@@ -200,8 +200,8 @@ func (ac *reconciler) validate(ctx context.Context, req *admissionv1.AdmissionRe
 		if hasExampleData && hasExampleChecksumAnnotation &&
 			exampleChecksum != configmap.Checksum(exampleData) {
 			return fmt.Errorf(
-				"%q modified, you likely wanted to create an unindented configuration",
-				configmap.ExampleKey)
+				"the update modifies a key in %q which is probably not what you want. Instead, copy the respective setting to the top-level of the ConfigMap, directly below %q",
+				configmap.ExampleKey, "data")
 		}
 
 		inputs := []reflect.Value{


Test patch:
diff --git a/webhook/configmaps/configmaps_test.go b/webhook/configmaps/configmaps_test.go
index f595116e1..6fc903b77 100644
--- a/webhook/configmaps/configmaps_test.go
+++ b/webhook/configmaps/configmaps_test.go
@@ -255,7 +255,7 @@ func TestDenyInvalidUpdateConfigMapExample(t *testing.T) {
 
 	resp := ac.Admit(ctx, createCreateConfigMapRequest(ctx, t, r))
 
-	ExpectFailsWith(t, resp, fmt.Sprintf("%q modified", configmap.ExampleKey))
+	ExpectFailsWith(t, resp, fmt.Sprintf("a key in %q", configmap.ExampleKey))
 }
 
 type config struct {