{"action":"created","issue":{"url":"https://api.github.com/repos/golang/gddo/issues/339","labels_url":"https://api.github.com/repos/golang/gddo/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/golang/gddo/issues/339/comments","events_url":"https://api.github.com/repos/golang/gddo/issues/339/events","html_url":"https://github.com/golang/gddo/issues/339","id":111981573,"number":339,"title":"Mismatch in count, list and graph of imports when some of imports are (currently) invalid.","user":{"login":"shurcooL","id":1924134,"avatar_url":"https://avatars.githubusercontent.com/u/1924134?v=3","gravatar_id":"","url":"https://api.github.com/users/shurcooL","html_url":"https://github.com/shurcooL","followers_url":"https://api.github.com/users/shurcooL/followers","following_url":"https://api.github.com/users/shurcooL/following{/other_user}","gists_url":"https://api.github.com/users/shurcooL/gists{/gist_id}","starred_url":"https://api.github.com/users/shurcooL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shurcooL/subscriptions","organizations_url":"https://api.github.com/users/shurcooL/orgs","repos_url":"https://api.github.com/users/shurcooL/repos","events_url":"https://api.github.com/users/shurcooL/events{/privacy}","received_events_url":"https://api.github.com/users/shurcooL/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-17T19:46:42Z","updated_at":"2015-10-17T20:02:43Z","closed_at":null,"body":"Due to packages moving, being renamed, or deleted, sometimes there are Go packages that import invalid or non-existent Go packages. Such code would not compile (unless you have vendored dependencies, etc.), but its documentation can and is still displayed by godoc.org.\r\n\r\nHowever, when a Go package imports an invalid import path, there is an inconsistency between the number of imports, the list of imports, and the graph of imports.\r\n\r\nReproduce case:\r\n\r\nhttps://godoc.org/gist.github.com/984289e2daff6f9fd72d.git\r\n\r\nIt imports a total of 3 Go packages. Two valid Go packages and one invalid one (it's a folder that contains no .go files). It would fail to compile. However, notice that:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1924134/10560877/e30401a8-74cc-11e5-9c58-68bed15393c6.png)\r\n\r\nYet when you click that link, only 2 packages (the valid ones) are listed:\r\n\r\nhttps://godoc.org/gist.github.com/984289e2daff6f9fd72d.git?imports\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1924134/10560879/f6189e70-74cc-11e5-9a0d-fc3ec6bdce03.png)\r\n\r\nThe graph view shows all imports:\r\n\r\nhttps://godoc.org/gist.github.com/984289e2daff6f9fd72d.git?import-graph&hide=1\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1924134/10560881/0670c842-74cd-11e5-85a1-fbd527972328.png)\r\n\r\nSince godoc.org doesn't check if Go packages compile, it shouldn't try to hide them. I am guessing it's an unintended bug.\r\n\r\nPretty minor issue, reporting because I noticed it."},"comment":{"url":"https://api.github.com/repos/golang/gddo/issues/comments/148947943","html_url":"https://github.com/golang/gddo/issues/339#issuecomment-148947943","issue_url":"https://api.github.com/repos/golang/gddo/issues/339","id":148947943,"user":{"login":"shurcooL","id":1924134,"avatar_url":"https://avatars.githubusercontent.com/u/1924134?v=3","gravatar_id":"","url":"https://api.github.com/users/shurcooL","html_url":"https://github.com/shurcooL","followers_url":"https://api.github.com/users/shurcooL/followers","following_url":"https://api.github.com/users/shurcooL/following{/other_user}","gists_url":"https://api.github.com/users/shurcooL/gists{/gist_id}","starred_url":"https://api.github.com/users/shurcooL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shurcooL/subscriptions","organizations_url":"https://api.github.com/users/shurcooL/orgs","repos_url":"https://api.github.com/users/shurcooL/repos","events_url":"https://api.github.com/users/shurcooL/events{/privacy}","received_events_url":"https://api.github.com/users/shurcooL/received_events","type":"User","site_admin":false},"created_at":"2015-10-17T20:02:42Z","updated_at":"2015-10-17T20:02:42Z","body":"The problem is not in the templates (rendering step) like I thought, it's in the database. Some logic results in the database not having all of its imports.\r\n\r\n```Go\r\npkgs, err = db.Packages(pdoc.Imports)\r\nif err != nil {\r\n\treturn err\r\n}\r\n```\r\n\r\nThat results in just 2 packages, \"fmt\" and \"net\".\r\n"}}