{"action":"created","comment":{"url":"https://api.github.com/repos/gravitational/configure/pulls/comments/47630325","id":47630325,"diff_hunk":"@@ -0,0 +1,222 @@\n+/*\n+Copyright 2015 Gravitational, Inc.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+package cxml\n+\n+import (\n+\t\"encoding/xml\"\n+\t\"io\"\n+\t\"strings\"\n+\n+\t\"github.com/gravitational/trace\"\n+)\n+\n+// TransofrmFunc is a function that can transform incoming token\n+// into a series of outgoing tokens when traversing XML tree\n+type TransformFunc func(parents *NodeList, in xml.Token) []xml.Token\n+\n+// ConditionFunc is accepted by some transform function generators\n+// so they could be applied conditionaly\n+type ConditionFunc func(parents *NodeList, in xml.Token) bool\n+\n+// TransformXML parses the XML tree, traverses it and calls TransformFunc\n+// on each XML token, writing the output to the writer, resulting in a\n+// transformed XML tree\n+func TransformXML(r io.Reader, w io.Writer, fn TransformFunc, indent bool) error {","path":"cxml/xml.go","position":37,"original_position":37,"commit_id":"cc9409647a6a24dfe0cec5bb513da087c12d4a35","original_commit_id":"cc9409647a6a24dfe0cec5bb513da087c12d4a35","user":{"login":"a-palchikov","id":965809,"avatar_url":"https://avatars.githubusercontent.com/u/965809?v=3","gravatar_id":"","url":"https://api.github.com/users/a-palchikov","html_url":"https://github.com/a-palchikov","followers_url":"https://api.github.com/users/a-palchikov/followers","following_url":"https://api.github.com/users/a-palchikov/following{/other_user}","gists_url":"https://api.github.com/users/a-palchikov/gists{/gist_id}","starred_url":"https://api.github.com/users/a-palchikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-palchikov/subscriptions","organizations_url":"https://api.github.com/users/a-palchikov/orgs","repos_url":"https://api.github.com/users/a-palchikov/repos","events_url":"https://api.github.com/users/a-palchikov/events{/privacy}","received_events_url":"https://api.github.com/users/a-palchikov/received_events","type":"User","site_admin":false},"body":"Better to accept `xml.Decoder`/`xml.Encoder` - additional work performed in 38-42 runs counter to principle of single responsibility. This will make `TranformXML` more composable and simpler:\r\n```go\r\nTransformXML(r *xml.Decoder, w *xml.Encoder, fn TransformFunc) bool\r\n```","created_at":"2015-12-15T12:36:03Z","updated_at":"2015-12-15T12:36:03Z","html_url":"https://github.com/gravitational/configure/pull/8#discussion_r47630325","pull_request_url":"https://api.github.com/repos/gravitational/configure/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/gravitational/configure/pulls/comments/47630325"},"html":{"href":"https://github.com/gravitational/configure/pull/8#discussion_r47630325"},"pull_request":{"href":"https://api.github.com/repos/gravitational/configure/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/gravitational/configure/pulls/8","id":53647114,"html_url":"https://github.com/gravitational/configure/pull/8","diff_url":"https://github.com/gravitational/configure/pull/8.diff","patch_url":"https://github.com/gravitational/configure/pull/8.patch","issue_url":"https://api.github.com/repos/gravitational/configure/issues/8","number":8,"state":"open","locked":false,"title":"Alexander/xmltools","user":{"login":"klizhentas","id":13717,"avatar_url":"https://avatars.githubusercontent.com/u/13717?v=3","gravatar_id":"","url":"https://api.github.com/users/klizhentas","html_url":"https://github.com/klizhentas","followers_url":"https://api.github.com/users/klizhentas/followers","following_url":"https://api.github.com/users/klizhentas/following{/other_user}","gists_url":"https://api.github.com/users/klizhentas/gists{/gist_id}","starred_url":"https://api.github.com/users/klizhentas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klizhentas/subscriptions","organizations_url":"https://api.github.com/users/klizhentas/orgs","repos_url":"https://api.github.com/users/klizhentas/repos","events_url":"https://api.github.com/users/klizhentas/events{/privacy}","received_events_url":"https://api.github.com/users/klizhentas/received_events","type":"User","site_admin":false},"body":"added support for xml tools: helper method and tree transformations on top of standard library","created_at":"2015-12-15T01:12:41Z","updated_at":"2015-12-15T12:36:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e492e9e3a91fcdf2bb75f965b29f7c1dd2d2609","assignee":{"login":"a-palchikov","id":965809,"avatar_url":"https://avatars.githubusercontent.com/u/965809?v=3","gravatar_id":"","url":"https://api.github.com/users/a-palchikov","html_url":"https://github.com/a-palchikov","followers_url":"https://api.github.com/users/a-palchikov/followers","following_url":"https://api.github.com/users/a-palchikov/following{/other_user}","gists_url":"https://api.github.com/users/a-palchikov/gists{/gist_id}","starred_url":"https://api.github.com/users/a-palchikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-palchikov/subscriptions","organizations_url":"https://api.github.com/users/a-palchikov/orgs","repos_url":"https://api.github.com/users/a-palchikov/repos","events_url":"https://api.github.com/users/a-palchikov/events{/privacy}","received_events_url":"https://api.github.com/users/a-palchikov/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/gravitational/configure/pulls/8/commits","review_comments_url":"https://api.github.com/repos/gravitational/configure/pulls/8/comments","review_comment_url":"https://api.github.com/repos/gravitational/configure/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gravitational/configure/issues/8/comments","statuses_url":"https://api.github.com/repos/gravitational/configure/statuses/cc9409647a6a24dfe0cec5bb513da087c12d4a35","head":{"label":"gravitational:alexander/xmltools","ref":"alexander/xmltools","sha":"cc9409647a6a24dfe0cec5bb513da087c12d4a35","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":44502731,"name":"configure","full_name":"gravitational/configure","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/configure","description":"Confiugure is a golang library that populates a struct from environment variables, command line arugments and YAML files.","fork":false,"url":"https://api.github.com/repos/gravitational/configure","forks_url":"https://api.github.com/repos/gravitational/configure/forks","keys_url":"https://api.github.com/repos/gravitational/configure/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/configure/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/configure/teams","hooks_url":"https://api.github.com/repos/gravitational/configure/hooks","issue_events_url":"https://api.github.com/repos/gravitational/configure/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/configure/events","assignees_url":"https://api.github.com/repos/gravitational/configure/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/configure/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/configure/tags","blobs_url":"https://api.github.com/repos/gravitational/configure/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/configure/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/configure/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/configure/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/configure/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/configure/languages","stargazers_url":"https://api.github.com/repos/gravitational/configure/stargazers","contributors_url":"https://api.github.com/repos/gravitational/configure/contributors","subscribers_url":"https://api.github.com/repos/gravitational/configure/subscribers","subscription_url":"https://api.github.com/repos/gravitational/configure/subscription","commits_url":"https://api.github.com/repos/gravitational/configure/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/configure/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/configure/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/configure/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/configure/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/configure/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/configure/merges","archive_url":"https://api.github.com/repos/gravitational/configure/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/configure/downloads","issues_url":"https://api.github.com/repos/gravitational/configure/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/configure/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/configure/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/configure/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/configure/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/configure/releases{/id}","created_at":"2015-10-19T00:36:05Z","updated_at":"2015-11-26T04:49:01Z","pushed_at":"2015-12-15T01:12:42Z","git_url":"git://github.com/gravitational/configure.git","ssh_url":"git@github.com:gravitational/configure.git","clone_url":"https://github.com/gravitational/configure.git","svn_url":"https://github.com/gravitational/configure","homepage":"","size":46,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"gravitational:master","ref":"master","sha":"a9b61eb676f652b5d1eae26985752ed5299b2095","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":44502731,"name":"configure","full_name":"gravitational/configure","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/configure","description":"Confiugure is a golang library that populates a struct from environment variables, command line arugments and YAML files.","fork":false,"url":"https://api.github.com/repos/gravitational/configure","forks_url":"https://api.github.com/repos/gravitational/configure/forks","keys_url":"https://api.github.com/repos/gravitational/configure/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/configure/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/configure/teams","hooks_url":"https://api.github.com/repos/gravitational/configure/hooks","issue_events_url":"https://api.github.com/repos/gravitational/configure/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/configure/events","assignees_url":"https://api.github.com/repos/gravitational/configure/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/configure/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/configure/tags","blobs_url":"https://api.github.com/repos/gravitational/configure/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/configure/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/configure/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/configure/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/configure/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/configure/languages","stargazers_url":"https://api.github.com/repos/gravitational/configure/stargazers","contributors_url":"https://api.github.com/repos/gravitational/configure/contributors","subscribers_url":"https://api.github.com/repos/gravitational/configure/subscribers","subscription_url":"https://api.github.com/repos/gravitational/configure/subscription","commits_url":"https://api.github.com/repos/gravitational/configure/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/configure/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/configure/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/configure/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/configure/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/configure/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/configure/merges","archive_url":"https://api.github.com/repos/gravitational/configure/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/configure/downloads","issues_url":"https://api.github.com/repos/gravitational/configure/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/configure/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/configure/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/configure/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/configure/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/configure/releases{/id}","created_at":"2015-10-19T00:36:05Z","updated_at":"2015-11-26T04:49:01Z","pushed_at":"2015-12-15T01:12:42Z","git_url":"git://github.com/gravitational/configure.git","ssh_url":"git@github.com:gravitational/configure.git","clone_url":"https://github.com/gravitational/configure.git","svn_url":"https://github.com/gravitational/configure","homepage":"","size":46,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gravitational/configure/pulls/8"},"html":{"href":"https://github.com/gravitational/configure/pull/8"},"issue":{"href":"https://api.github.com/repos/gravitational/configure/issues/8"},"comments":{"href":"https://api.github.com/repos/gravitational/configure/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/gravitational/configure/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/gravitational/configure/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gravitational/configure/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/gravitational/configure/statuses/cc9409647a6a24dfe0cec5bb513da087c12d4a35"}}}}