Skip to content

Commit 17a0655

Browse files
committed
group warnings
1 parent bc5e6d8 commit 17a0655

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

patches/0011-crypto-internal-backend-add-deprecation-warnings-for.patch renamed to patches/0011-Add-deprecation-warnings-for-specific-crypto-backend.patch

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: bot-for-go[bot] <199222863+bot-for-go[bot]@users.noreply.github.com>
33
Date: Wed, 24 Sep 2025 12:46:04 +0100
4-
Subject: [PATCH] crypto/internal/backend: add deprecation warnings for
5-
specific crypto backends
4+
Subject: [PATCH] Add deprecation warnings for specific crypto backends
65

76
Add deprecation warnings for opensslcrypto, cngcrypto, and darwincrypto
87
GOEXPERIMENT values in CI environments (GitHub Actions and Azure DevOps).
@@ -24,9 +23,9 @@ warning when systemcrypto automatically selects a backend.
2423
---
2524
src/crypto/internal/backend/cng_windows.go | 4 +
2625
src/crypto/internal/backend/darwin_darwin.go | 4 +
27-
.../backend/deprecation/deprecation.go | 89 +++++++++++++++++++
26+
.../backend/deprecation/deprecation.go | 96 +++++++++++++++++++
2827
.../internal/opensslsetup/opensslsetup.go | 4 +
29-
4 files changed, 101 insertions(+)
28+
4 files changed, 108 insertions(+)
3029
create mode 100644 src/crypto/internal/backend/deprecation/deprecation.go
3130

3231
diff --git a/src/crypto/internal/backend/cng_windows.go b/src/crypto/internal/backend/cng_windows.go
@@ -75,10 +74,10 @@ index fea0f284de2439..3b8da177cf3c40 100644
7574
panic("darwincrypto: " + err.Error())
7675
diff --git a/src/crypto/internal/backend/deprecation/deprecation.go b/src/crypto/internal/backend/deprecation/deprecation.go
7776
new file mode 100644
78-
index 00000000000000..dd19b51a8112f1
77+
index 00000000000000..0e02fcad6bffa1
7978
--- /dev/null
8079
+++ b/src/crypto/internal/backend/deprecation/deprecation.go
81-
@@ -0,0 +1,89 @@
80+
@@ -0,0 +1,96 @@
8281
+// Package deprecation provides utilities for emitting deprecation warnings
8382
+// in CI environments without affecting normal program output.
8483
+
@@ -113,30 +112,33 @@ index 00000000000000..dd19b51a8112f1
113112
+func isBackendAutoSelected(backend string) bool {
114113
+ goexperiment, _ := syscall.Getenv("GOEXPERIMENT")
115114
+
116-
+ // If GOEXPERIMENT contains "systemcrypto", then any specific backend
117-
+ // that gets loaded was auto-selected, not explicitly chosen
118-
+ if goexperiment == "systemcrypto" ||
119-
+ goexperiment == "" { // systemcrypto is default in Go 1.25+
115+
+ // If GOEXPERIMENT is empty, systemcrypto is the default in Go 1.25+
116+
+ if goexperiment == "" {
120117
+ return true
121118
+ }
122119
+
123-
+ // Check if systemcrypto is in a comma-separated list
124-
+ // (though this is less common, systemcrypto usually stands alone)
120+
+ // Check if the user explicitly specified this deprecated backend
121+
+ return !isBackendExplicitlySpecified(backend, goexperiment)
122+
+}
123+
+
124+
+// isBackendExplicitlySpecified checks if the specific backend was explicitly
125+
+// specified in the GOEXPERIMENT string
126+
+func isBackendExplicitlySpecified(backend, goexperiment string) bool {
127+
+ // Parse the comma-separated GOEXPERIMENT string
125128
+ for i := 0; i < len(goexperiment); {
126129
+ // Find the start of the next experiment name
127130
+ start := i
128131
+ for i < len(goexperiment) && goexperiment[i] != ',' {
129132
+ i++
130133
+ }
131134
+ experiment := goexperiment[start:i]
132-
+ if experiment == "systemcrypto" {
135+
+ if experiment == backend {
133136
+ return true
134137
+ }
135138
+ if i < len(goexperiment) {
136139
+ i++ // skip the comma
137140
+ }
138141
+ }
139-
+
140142
+ return false
141143
+}
142144
+
@@ -161,12 +163,16 @@ index 00000000000000..dd19b51a8112f1
161163
+
162164
+// emitGitHubActionsWarning outputs a GitHub Actions warning
163165
+func emitGitHubActionsWarning(backend string) {
164-
+ fmt.Fprintf(os.Stderr, "::warning::GOEXPERIMENT=%s is deprecated. Use GOEXPERIMENT=systemcrypto instead, or remove GOEXPERIMENT entirely as systemcrypto is now the default.\n", backend)
166+
+ fmt.Fprintf(os.Stderr,
167+
+ "::warning title=GOEXPERIMENT_DEPRECATED::GOEXPERIMENT=%s is deprecated. Use GOEXPERIMENT=systemcrypto instead, or remove GOEXPERIMENT entirely as systemcrypto is now the default.\n",
168+
+ backend)
165169
+}
166170
+
167171
+// emitAzureDevOpsWarning outputs an Azure DevOps warning
168172
+func emitAzureDevOpsWarning(backend string) {
169-
+ fmt.Fprintf(os.Stderr, "##vso[task.logissue type=warning]GOEXPERIMENT=%s is deprecated. Use GOEXPERIMENT=systemcrypto instead, or remove GOEXPERIMENT entirely as systemcrypto is now the default.\n", backend)
173+
+ fmt.Fprintf(os.Stderr,
174+
+ "##vso[task.logissue type=warning;code=GOEXPERIMENT_DEPRECATED;]GOEXPERIMENT=%s is deprecated. Use GOEXPERIMENT=systemcrypto instead, or remove GOEXPERIMENT entirely as systemcrypto is now the default.\n",
175+
+ backend)
170176
+}
171177
diff --git a/src/crypto/internal/backend/internal/opensslsetup/opensslsetup.go b/src/crypto/internal/backend/internal/opensslsetup/opensslsetup.go
172178
index d816f1be17b6a1..31c48b8d2036c7 100644

0 commit comments

Comments
 (0)