{"action":"created","issue":{"url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/404","repository_url":"https://api.github.com/repos/hairyhenderson/gomplate","labels_url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/404/labels{/name}","comments_url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/404/comments","events_url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/404/events","html_url":"https://github.com/hairyhenderson/gomplate/issues/404","id":363175418,"node_id":"MDU6SXNzdWUzNjMxNzU0MTg=","number":404,"title":"Add datasources to root context","user":{"login":"hairyhenderson","id":2037086,"node_id":"MDQ6VXNlcjIwMzcwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2037086?v=4","gravatar_id":"","url":"https://api.github.com/users/hairyhenderson","html_url":"https://github.com/hairyhenderson","followers_url":"https://api.github.com/users/hairyhenderson/followers","following_url":"https://api.github.com/users/hairyhenderson/following{/other_user}","gists_url":"https://api.github.com/users/hairyhenderson/gists{/gist_id}","starred_url":"https://api.github.com/users/hairyhenderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairyhenderson/subscriptions","organizations_url":"https://api.github.com/users/hairyhenderson/orgs","repos_url":"https://api.github.com/users/hairyhenderson/repos","events_url":"https://api.github.com/users/hairyhenderson/events{/privacy}","received_events_url":"https://api.github.com/users/hairyhenderson/received_events","type":"User","site_admin":false},"labels":[{"id":315537433,"node_id":"MDU6TGFiZWwzMTU1Mzc0MzM=","url":"https://api.github.com/repos/hairyhenderson/gomplate/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"hairyhenderson","id":2037086,"node_id":"MDQ6VXNlcjIwMzcwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2037086?v=4","gravatar_id":"","url":"https://api.github.com/users/hairyhenderson","html_url":"https://github.com/hairyhenderson","followers_url":"https://api.github.com/users/hairyhenderson/followers","following_url":"https://api.github.com/users/hairyhenderson/following{/other_user}","gists_url":"https://api.github.com/users/hairyhenderson/gists{/gist_id}","starred_url":"https://api.github.com/users/hairyhenderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairyhenderson/subscriptions","organizations_url":"https://api.github.com/users/hairyhenderson/orgs","repos_url":"https://api.github.com/users/hairyhenderson/repos","events_url":"https://api.github.com/users/hairyhenderson/events{/privacy}","received_events_url":"https://api.github.com/users/hairyhenderson/received_events","type":"User","site_admin":false},"assignees":[{"login":"hairyhenderson","id":2037086,"node_id":"MDQ6VXNlcjIwMzcwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2037086?v=4","gravatar_id":"","url":"https://api.github.com/users/hairyhenderson","html_url":"https://github.com/hairyhenderson","followers_url":"https://api.github.com/users/hairyhenderson/followers","following_url":"https://api.github.com/users/hairyhenderson/following{/other_user}","gists_url":"https://api.github.com/users/hairyhenderson/gists{/gist_id}","starred_url":"https://api.github.com/users/hairyhenderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairyhenderson/subscriptions","organizations_url":"https://api.github.com/users/hairyhenderson/orgs","repos_url":"https://api.github.com/users/hairyhenderson/repos","events_url":"https://api.github.com/users/hairyhenderson/events{/privacy}","received_events_url":"https://api.github.com/users/hairyhenderson/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-09-24T14:37:27Z","updated_at":"2018-11-14T20:52:31Z","closed_at":null,"author_association":"OWNER","body":"This is an _extraction_ from #210, where one of the items that @f4tq worked on was the removal of the need for the `datasource`/`ds` function, by adding datasources to the root context (i.e. the default `.` in a template).\r\n\r\nI'm not 100% certain this can fully work, though the initial work done by @f4tq in [his fork](\r\nhttps://github.com/f4tq/gomplate/commit/c4145ea086da1deeca0cecd278c63e0dad92d2b3) works for the simple case (i.e. datasource with no arguments).\r\n\r\nThis would make the following commands equivalent:\r\n\r\n```console\r\n$ gomplate -d config=some:///config/source -i '{{ (ds \"config\").value }}'\r\n$ gomplate -d config=some:///config/source -i '{{ .config.value }}'\r\n```\r\n\r\nStill to figure out:\r\n- what to do about datasources that take multiple (required or optional) arguments? do we ignore these and only support the simple case?\r\n- a key designs around datasources is that they're lazily-loaded, and this needs to be retained - i.e. a datasource is only read when needed (i.e. when the `datasource` function is executed), and if `datasource` is never called (due to a negative `if` condition, for example), gomplate must not attempt to read the datasource at all\r\n- we can't break current usage of `.Env` - this should be straightforward, though"},"comment":{"url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/comments/438814077","html_url":"https://github.com/hairyhenderson/gomplate/issues/404#issuecomment-438814077","issue_url":"https://api.github.com/repos/hairyhenderson/gomplate/issues/404","id":438814077,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODgxNDA3Nw==","user":{"login":"hairyhenderson","id":2037086,"node_id":"MDQ6VXNlcjIwMzcwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2037086?v=4","gravatar_id":"","url":"https://api.github.com/users/hairyhenderson","html_url":"https://github.com/hairyhenderson","followers_url":"https://api.github.com/users/hairyhenderson/followers","following_url":"https://api.github.com/users/hairyhenderson/following{/other_user}","gists_url":"https://api.github.com/users/hairyhenderson/gists{/gist_id}","starred_url":"https://api.github.com/users/hairyhenderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairyhenderson/subscriptions","organizations_url":"https://api.github.com/users/hairyhenderson/orgs","repos_url":"https://api.github.com/users/hairyhenderson/repos","events_url":"https://api.github.com/users/hairyhenderson/events{/privacy}","received_events_url":"https://api.github.com/users/hairyhenderson/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T20:52:31Z","updated_at":"2018-11-14T20:52:31Z","author_association":"OWNER","body":"@ArcticSnowman helm doesn't load `.Values` dynamically (or, any of the other items in the context), so it doesn't have this challenge 😉.\r\n\r\nI'm basically taking the pre-load approach in #424 - the tradeoff then is if you want to use a datasource in your context, it'll be pre-loaded."}}
{"actor":{"display_login":"hairyhenderson"}}