{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/12868","labels_url":"https://api.github.com/repos/golang/go/issues/12868/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12868/comments","events_url":"https://api.github.com/repos/golang/go/issues/12868/events","html_url":"https://github.com/golang/go/issues/12868","id":110282562,"number":12868,"title":"proposal: add os/exec.Cmd.SetEnv method","user":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/Proposal","name":"Proposal","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-07T17:59:42Z","updated_at":"2015-10-08T16:56:17Z","closed_at":null,"body":"I'd like to add a method to `os/exec.Cmd` to ease setting environment variables on commands before they're run.\r\n\r\nManipulating `Env []string` lists is tedious and error-prone, especially considering potential duplicates. (since programs would others choose either the first or last occurrence, unpredictably)\r\n\r\nThe proposed `Cmd.SetEnv(key, value string)` method would be documented as removing duplicates.\r\n\r\nOn Windows, environment variables are case-insensitive, so the method on Windows should de-dup case insensitively.\r\n\r\nThis method would replace a handful of copies of `func mergeEnvLists` that exist in various forms around the standard library, tests, and x/* repos.\r\n\r\n/cc @ianlancetaylor @adg @rsc @griesemer @robpike "},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/146621594","html_url":"https://github.com/golang/go/issues/12868#issuecomment-146621594","issue_url":"https://api.github.com/repos/golang/go/issues/12868","id":146621594,"user":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T16:56:17Z","updated_at":"2015-10-08T16:56:17Z","body":"We can't dedup in Start or Run. That would be a change of behavior and it's valid (even if weird) to have multi-valued keys. And if we did dedup: first or last? Different programs pick a different one. "}}