{"action":"created","issue":{"url":"https://api.github.com/repos/vanadium/issues/issues/1087","repository_url":"https://api.github.com/repos/vanadium/issues","labels_url":"https://api.github.com/repos/vanadium/issues/issues/1087/labels{/name}","comments_url":"https://api.github.com/repos/vanadium/issues/issues/1087/comments","events_url":"https://api.github.com/repos/vanadium/issues/issues/1087/events","html_url":"https://github.com/vanadium/issues/issues/1087","id":127010643,"number":1087,"title":"Embed gosh.Opts in gosh.Shell","user":{"login":"tatatodd","id":5453737,"avatar_url":"https://avatars.githubusercontent.com/u/5453737?v=3","gravatar_id":"","url":"https://api.github.com/users/tatatodd","html_url":"https://github.com/tatatodd","followers_url":"https://api.github.com/users/tatatodd/followers","following_url":"https://api.github.com/users/tatatodd/following{/other_user}","gists_url":"https://api.github.com/users/tatatodd/gists{/gist_id}","starred_url":"https://api.github.com/users/tatatodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatatodd/subscriptions","organizations_url":"https://api.github.com/users/tatatodd/orgs","repos_url":"https://api.github.com/users/tatatodd/repos","events_url":"https://api.github.com/users/tatatodd/events{/privacy}","received_events_url":"https://api.github.com/users/tatatodd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vanadium/issues/labels/Area:%20Core","name":"Area: Core","color":"fad8c7"},{"url":"https://api.github.com/repos/vanadium/issues/labels/Lang:%20Go","name":"Lang: Go","color":"5319e7"}],"state":"closed","locked":false,"assignee":{"login":"asadovsky","id":538767,"avatar_url":"https://avatars.githubusercontent.com/u/538767?v=3","gravatar_id":"","url":"https://api.github.com/users/asadovsky","html_url":"https://github.com/asadovsky","followers_url":"https://api.github.com/users/asadovsky/followers","following_url":"https://api.github.com/users/asadovsky/following{/other_user}","gists_url":"https://api.github.com/users/asadovsky/gists{/gist_id}","starred_url":"https://api.github.com/users/asadovsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asadovsky/subscriptions","organizations_url":"https://api.github.com/users/asadovsky/orgs","repos_url":"https://api.github.com/users/asadovsky/repos","events_url":"https://api.github.com/users/asadovsky/events{/privacy}","received_events_url":"https://api.github.com/users/asadovsky/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-01-16T08:41:28Z","updated_at":"2016-02-26T21:06:04Z","closed_at":"2016-02-26T21:06:04Z","body":"Our current gosh usage looks like this:\r\n\r\n```\r\nsh := gosh.NewShell(gosh.Opts{Fatalf: t.Fatalf, Logf: t.Logf})\r\ndefer sh.Cleanup()\r\nsh.Opts.PropagateChildOutput = true\r\nsh.Vars[\"foo\"] = \"bar\"\r\n```\r\n\r\nThe Opts is kind of annoying, since it's inconsistent with Cmd (where all options are at the top-level), and its easy to forget.  If we embed gosh.Opts in gosh.Shell, we can write this instead, which seems better:\r\n\r\n```\r\nsh := gosh.NewShell(gosh.Opts{Fatalf: t.Fatalf, Logf: t.Logf})\r\ndefer sh.Cleanup()\r\nsh.PropagateChildOutput = true\r\nsh.Vars[\"foo\"] = \"bar\"\r\n```\r\n\r\nOf course for this particular example, we could always use the literal directly, which is even simpler.  But the general problem still holds.\r\n\r\n```\r\nsh := gosh.NewShell(gosh.Opts{Fatalf: t.Fatalf, Logf: t.Logf, PropagateChildOutput: true})\r\ndefer sh.Cleanup()\r\nsh.Vars[\"foo\"] = \"bar\"\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/vanadium/issues/issues/comments/189483393","html_url":"https://github.com/vanadium/issues/issues/1087#issuecomment-189483393","issue_url":"https://api.github.com/repos/vanadium/issues/issues/1087","id":189483393,"user":{"login":"asadovsky","id":538767,"avatar_url":"https://avatars.githubusercontent.com/u/538767?v=3","gravatar_id":"","url":"https://api.github.com/users/asadovsky","html_url":"https://github.com/asadovsky","followers_url":"https://api.github.com/users/asadovsky/followers","following_url":"https://api.github.com/users/asadovsky/following{/other_user}","gists_url":"https://api.github.com/users/asadovsky/gists{/gist_id}","starred_url":"https://api.github.com/users/asadovsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asadovsky/subscriptions","organizations_url":"https://api.github.com/users/asadovsky/orgs","repos_url":"https://api.github.com/users/asadovsky/repos","events_url":"https://api.github.com/users/asadovsky/events{/privacy}","received_events_url":"https://api.github.com/users/asadovsky/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T21:06:04Z","updated_at":"2016-02-26T21:06:04Z","body":"Done in https://v.io/c/20205 - gosh.Opts is gone, and all options are now fields in Shell."}}