{"action":"created","issue":{"url":"https://api.github.com/repos/ua-parser/uap-go/issues/7","labels_url":"https://api.github.com/repos/ua-parser/uap-go/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/ua-parser/uap-go/issues/7/comments","events_url":"https://api.github.com/repos/ua-parser/uap-go/issues/7/events","html_url":"https://github.com/ua-parser/uap-go/pull/7","id":57669974,"number":7,"title":"Fix os replacement logic","user":{"login":"davemarchevsky","id":1219664,"avatar_url":"https://avatars.githubusercontent.com/u/1219664?v=3","gravatar_id":"","url":"https://api.github.com/users/davemarchevsky","html_url":"https://github.com/davemarchevsky","followers_url":"https://api.github.com/users/davemarchevsky/followers","following_url":"https://api.github.com/users/davemarchevsky/following{/other_user}","gists_url":"https://api.github.com/users/davemarchevsky/gists{/gist_id}","starred_url":"https://api.github.com/users/davemarchevsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davemarchevsky/subscriptions","organizations_url":"https://api.github.com/users/davemarchevsky/orgs","repos_url":"https://api.github.com/users/davemarchevsky/repos","events_url":"https://api.github.com/users/davemarchevsky/events{/privacy}","received_events_url":"https://api.github.com/users/davemarchevsky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-13T23:53:36Z","updated_at":"2015-02-14T16:00:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ua-parser/uap-go/pulls/7","html_url":"https://github.com/ua-parser/uap-go/pull/7","diff_url":"https://github.com/ua-parser/uap-go/pull/7.diff","patch_url":"https://github.com/ua-parser/uap-go/pull/7.patch"},"body":"When testing against uap-core v0.4.0 (`master`'s `HEAD` doesn't work due to https://github.com/ua-parser/uap-core/issues/28), I saw this error when running `go test`:\r\n\r\n```go\r\n../../test_resources/test_device.yaml: PASS\r\n../../test_resources/test_user_agent_parser_os.yaml: PASS\r\n../../test_resources/additional_os_tests.yaml: FAIL\r\nExpected: map[user_agent_string:Mozilla/5.0 (Linux; U; Android Donut; de-de; HTC Tattoo 1.52.161.1 Build/Donut) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1 family:Android major:1 minor:2 patch: patch_minor:]\r\nActual: &{Android 1   }\r\n--- FAIL: TestAdditionalOs (0.00 seconds)\r\n../../test_resources/test_user_agent_parser.yaml: PASS\r\n../../test_resources/firefox_user_agent_strings.yaml: PASS\r\n../../test_resources/pgts_browser_list.yaml: PASS\r\nFAIL\r\nexit status 1\r\nFAIL\t_/bitly/src/github/uap-go/uaparser\t8.960s\r\n```\r\n\r\nIn this case it seems that the minor version isn't being set because there's no second submatch. I skimmed uap-python and based on [this](https://github.com/ua-parser/uap-python/blob/master/ua_parser/user_agent_parser.py#L111) function I believe that this is incorrect - minor version should be populated according to the following logic:\r\n\r\n```python\r\nif self.v2_replacement:\r\n        v2 = self.v2_replacement\r\nelif match.lastindex and match.lastindex >= 3:\r\n        v2 = match.group(3)\r\n```\r\n\r\nAlso cleaned up logic in `os.Match` to more linear."},"comment":{"url":"https://api.github.com/repos/ua-parser/uap-go/issues/comments/74380360","html_url":"https://github.com/ua-parser/uap-go/pull/7#issuecomment-74380360","issue_url":"https://api.github.com/repos/ua-parser/uap-go/issues/7","id":74380360,"user":{"login":"Ironholds","id":2487262,"avatar_url":"https://avatars.githubusercontent.com/u/2487262?v=3","gravatar_id":"","url":"https://api.github.com/users/Ironholds","html_url":"https://github.com/Ironholds","followers_url":"https://api.github.com/users/Ironholds/followers","following_url":"https://api.github.com/users/Ironholds/following{/other_user}","gists_url":"https://api.github.com/users/Ironholds/gists{/gist_id}","starred_url":"https://api.github.com/users/Ironholds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ironholds/subscriptions","organizations_url":"https://api.github.com/users/Ironholds/orgs","repos_url":"https://api.github.com/users/Ironholds/repos","events_url":"https://api.github.com/users/Ironholds/events{/privacy}","received_events_url":"https://api.github.com/users/Ironholds/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T16:00:10Z","updated_at":"2015-02-14T16:00:10Z","body":"Thanks!"}}