Source file src/runtime/runtime_clearenv.go
1 // Copyright 2025 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build linux 6 7 package runtime 8 9 import "unsafe" 10 11 var _cgo_clearenv unsafe.Pointer // pointer to C function 12 13 // Clear the C environment if cgo is loaded. 14 func clearenv_c() { 15 if _cgo_clearenv == nil { 16 return 17 } 18 asmcgocall(_cgo_clearenv, nil) 19 } 20 21 //go:linkname syscall_runtimeClearenv syscall.runtimeClearenv 22 func syscall_runtimeClearenv(env map[string]int) { 23 clearenv_c() 24 // Did we just unset GODEBUG? 25 if _, ok := env["GODEBUG"]; ok { 26 godebugEnv.Store(nil) 27 godebugNotify(true) 28 } 29 } 30