Unsetenv unsets a single environment variable.
package main import "os" func main() { os.Setenv("TMPDIR", "/my/tmp") defer os.Unsetenv("TMPDIR") }