runtime: add syscall.runtimeClearenv for Go 1.26

Go 1.26 added syscall.runtimeClearenv (called by syscall.Clearenv) which
must be provided by the runtime via go:linkname. Without it, the os
package fails to link.
This commit is contained in:
deadprogram
2026-04-10 14:31:22 +02:00
committed by Ron Evans
parent 59feac28b9
commit 451c57af92
+10
View File
@@ -27,6 +27,16 @@ func syscallUnsetenv(key string) {
unsetenv(&keydata[0])
}
// Clear the environment.
// Called from Go 1.26 and above.
//
//go:linkname syscallClearenv syscall.runtimeClearenv
func syscallClearenv(env map[string]int) {
for k := range env {
syscallUnsetenv(k)
}
}
// Compatibility with Go 1.19 and below.
//
//go:linkname syscall_setenv_c syscall.setenv_c