{"action":"created","issue":{"url":"https://api.github.com/repos/dustin/go-coap/issues/28","labels_url":"https://api.github.com/repos/dustin/go-coap/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/dustin/go-coap/issues/28/comments","events_url":"https://api.github.com/repos/dustin/go-coap/issues/28/events","html_url":"https://github.com/dustin/go-coap/pull/28","id":107767166,"number":28,"title":"Fix all MediaType constants to be of type MediaType instead of int","user":{"login":"dubek","id":9211,"avatar_url":"https://avatars.githubusercontent.com/u/9211?v=3","gravatar_id":"","url":"https://api.github.com/users/dubek","html_url":"https://github.com/dubek","followers_url":"https://api.github.com/users/dubek/followers","following_url":"https://api.github.com/users/dubek/following{/other_user}","gists_url":"https://api.github.com/users/dubek/gists{/gist_id}","starred_url":"https://api.github.com/users/dubek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dubek/subscriptions","organizations_url":"https://api.github.com/users/dubek/orgs","repos_url":"https://api.github.com/users/dubek/repos","events_url":"https://api.github.com/users/dubek/events{/privacy}","received_events_url":"https://api.github.com/users/dubek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-22T17:58:45Z","updated_at":"2015-09-22T19:12:08Z","closed_at":"2015-09-22T19:08:58Z","pull_request":{"url":"https://api.github.com/repos/dustin/go-coap/pulls/28","html_url":"https://github.com/dustin/go-coap/pull/28","diff_url":"https://github.com/dustin/go-coap/pull/28.diff","patch_url":"https://github.com/dustin/go-coap/pull/28.patch"},"body":"Before the fix only `coap.TextPlain` was of type `MediaType`; the other media type constants were of type `int`. The change is visible with the test program below.\r\n\r\nBefore the fix:\r\n\r\n```\r\n$ go run coap_types.go\r\ncoap.TextPlain type = %!t(coap.MediaType=0)\r\ncoap.AppXML type = %!t(int=41)\r\ncoap.AppJSON type =%!t(int=50)\r\n```\r\n\r\nAfter the fix:\r\n\r\n```\r\n$ go run coap_types.go\r\ncoap.TextPlain type = %!t(coap.MediaType=0)\r\ncoap.AppXML type = %!t(coap.MediaType=41)\r\ncoap.AppJSON type =%!t(coap.MediaType=50)\r\n```\r\n\r\nThe test program:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"github.com/dustin/go-coap\"\r\n)\r\n\r\nfunc main() {\r\n\tfmt.Printf(\"coap.TextPlain type = %t\\n\", coap.TextPlain)\r\n\tfmt.Printf(\"coap.AppXML type = %t\\n\", coap.AppXML)\r\n\tfmt.Printf(\"coap.AppJSON type =%t\\n\", coap.AppJSON)\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dustin/go-coap/issues/comments/142389093","html_url":"https://github.com/dustin/go-coap/pull/28#issuecomment-142389093","issue_url":"https://api.github.com/repos/dustin/go-coap/issues/28","id":142389093,"user":{"login":"dubek","id":9211,"avatar_url":"https://avatars.githubusercontent.com/u/9211?v=3","gravatar_id":"","url":"https://api.github.com/users/dubek","html_url":"https://github.com/dubek","followers_url":"https://api.github.com/users/dubek/followers","following_url":"https://api.github.com/users/dubek/following{/other_user}","gists_url":"https://api.github.com/users/dubek/gists{/gist_id}","starred_url":"https://api.github.com/users/dubek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dubek/subscriptions","organizations_url":"https://api.github.com/users/dubek/orgs","repos_url":"https://api.github.com/users/dubek/repos","events_url":"https://api.github.com/users/dubek/events{/privacy}","received_events_url":"https://api.github.com/users/dubek/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T19:12:08Z","updated_at":"2015-09-22T19:12:08Z","body":"Oh you're right. I meant to use `%T` for fmt to give the type. Thanks for the clarification."}}