-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Closed
Copy link
Labels
Description
by jon.forums:
What steps will reproduce the problem? Original spelunking: https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/H-3yxhonR_M To reproduce, run this snippet: http://play.golang.org/p/y_pB0QSPkh What is the expected output? ---> set `FAKE_ENV_VAR` envar to empty string ---> set `NOEXIST_ENV_VAR` envar to default `*uint16` value What do you see instead? ---> set `FAKE_ENV_VAR` envar to empty string setenv: The system could not find the environment option that was entered. Which compiler are you using (5g, 6g, 8g, gccgo)? 8g Which operating system are you using? Win7 32bit (working) and WinXP SP3 32bit (failing) Which version are you using? (run 'go version') Any recent version including: go version devel +1f7fdf4ad92d Fri May 31 21:44:32 2013 -0700 windows/386 Please provide any additional information below. I suspect differences in MSFT's SetEnvironmentVariableW impl for Win7 and XP handle v's default nil value from syscall.Setenv differently. I will be trying patches similar to the following and report back if appropriate: func Setenv(key, value string) error { ... if value == `` { a := utf16.Encode([]rune(value + "\x00")) v = &a[0] } if len(value) > 0 { ... } ... e := SetEnvironmentVariable(keyp, v) } }