summaryrefslogtreecommitdiff
path: root/misc/cgo/test/env.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/cgo/test/env.go')
-rw-r--r--misc/cgo/test/env.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/misc/cgo/test/env.go b/misc/cgo/test/env.go
index 1fb4e684c..8d3ba5877 100644
--- a/misc/cgo/test/env.go
+++ b/misc/cgo/test/env.go
@@ -10,12 +10,21 @@ package cgotest
import "C"
import (
"os"
+ "runtime"
"testing"
"unsafe"
)
// This is really an os package test but here for convenience.
func testSetEnv(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ // Go uses SetEnvironmentVariable on windows. Howerver,
+ // C runtime takes a *copy* at process startup of thei
+ // OS environment, and stores it in environ/envp.
+ // It is this copy that getenv/putenv manipulate.
+ t.Logf("skipping test")
+ return
+ }
const key = "CGO_OS_TEST_KEY"
const val = "CGO_OS_TEST_VALUE"
os.Setenv(key, val)