{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/13760","labels_url":"https://api.github.com/repos/golang/go/issues/13760/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/13760/comments","events_url":"https://api.github.com/repos/golang/go/issues/13760/events","html_url":"https://github.com/golang/go/issues/13760","id":124153972,"number":13760,"title":"type assertion does not work","user":{"login":"elebore","id":1163890,"avatar_url":"https://avatars.githubusercontent.com/u/1163890?v=3","gravatar_id":"","url":"https://api.github.com/users/elebore","html_url":"https://github.com/elebore","followers_url":"https://api.github.com/users/elebore/followers","following_url":"https://api.github.com/users/elebore/following{/other_user}","gists_url":"https://api.github.com/users/elebore/gists{/gist_id}","starred_url":"https://api.github.com/users/elebore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elebore/subscriptions","organizations_url":"https://api.github.com/users/elebore/orgs","repos_url":"https://api.github.com/users/elebore/repos","events_url":"https://api.github.com/users/elebore/events{/privacy}","received_events_url":"https://api.github.com/users/elebore/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-29T02:29:03Z","updated_at":"2015-12-29T07:57:46Z","closed_at":"2015-12-29T04:13:37Z","body":"There are two files,main.go and main1.go\r\n\r\n-------------------------content of main.go----------------------------------------\r\npackage main\r\nimport \"code.google.com/p/go.net/websocket\"\r\nfunc main() {\r\n\tconn := websocket.Conn{}\r\n\tTestFunc(&conn)\r\n}\r\n----------------------------------end of main.go--------------------------------------------------\r\n----------------------content of main1.go------------------------------------------\r\npackage main\r\nimport (\r\n\t\"fmt\"\r\n\t\"net\"\r\n\t\"reflect\"\r\n\t\"golang.org/x/net/websocket\"\r\n)\r\n\r\nfunc TestFunc(conn net.Conn) {\r\n\tswitch  conn.(type) {\r\n\tcase *websocket.Conn:\r\n\t\tfmt.Println(\"OK\")\r\n\tdefault:\r\n\t\tfmt.Println(\"NOT\")\r\n\t}\r\n}\r\n----------------------------------------end of main1.go----------------------------------------------\r\nWe should get OK from console by running this program on windows 10 compiling with go 1.5.2,but I got NOT,when I moved TestFunc to file main.go,then I got OK\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/167741675","html_url":"https://github.com/golang/go/issues/13760#issuecomment-167741675","issue_url":"https://api.github.com/repos/golang/go/issues/13760","id":167741675,"user":{"login":"prashantv","id":140159,"avatar_url":"https://avatars.githubusercontent.com/u/140159?v=3","gravatar_id":"","url":"https://api.github.com/users/prashantv","html_url":"https://github.com/prashantv","followers_url":"https://api.github.com/users/prashantv/followers","following_url":"https://api.github.com/users/prashantv/following{/other_user}","gists_url":"https://api.github.com/users/prashantv/gists{/gist_id}","starred_url":"https://api.github.com/users/prashantv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prashantv/subscriptions","organizations_url":"https://api.github.com/users/prashantv/orgs","repos_url":"https://api.github.com/users/prashantv/repos","events_url":"https://api.github.com/users/prashantv/events{/privacy}","received_events_url":"https://api.github.com/users/prashantv/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T07:57:46Z","updated_at":"2015-12-29T07:57:46Z","body":"@elebore In `main.go` you import websocket from code.google.com/p/go.net and in `main1.go` you import websocket from golang.org/x/net. Since they're not the same type, the type assertion is failing (as it should)."}}