{"action":"created","issue":{"url":"https://api.github.com/repos/tools/godep/issues/140","labels_url":"https://api.github.com/repos/tools/godep/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/tools/godep/issues/140/comments","events_url":"https://api.github.com/repos/tools/godep/issues/140/events","html_url":"https://github.com/tools/godep/issues/140","id":46996150,"number":140,"title":"godep does not skip \"testdata\" folders when enumerating Go packages.","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":[{"url":"https://api.github.com/repos/tools/godep/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"neurogeek","id":243474,"avatar_url":"https://avatars.githubusercontent.com/u/243474?v=3","gravatar_id":"","url":"https://api.github.com/users/neurogeek","html_url":"https://github.com/neurogeek","followers_url":"https://api.github.com/users/neurogeek/followers","following_url":"https://api.github.com/users/neurogeek/following{/other_user}","gists_url":"https://api.github.com/users/neurogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/neurogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neurogeek/subscriptions","organizations_url":"https://api.github.com/users/neurogeek/orgs","repos_url":"https://api.github.com/users/neurogeek/repos","events_url":"https://api.github.com/users/neurogeek/events{/privacy}","received_events_url":"https://api.github.com/users/neurogeek/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2014-10-28T07:13:27Z","updated_at":"2015-08-31T18:32:30Z","closed_at":"2015-08-26T14:38:57Z","body":"See the relevant code in [save.go#L293](https://github.com/tools/godep/blob/754ee6f4e0e5fc8d0ef2692fb239d15c7a09dd84/save.go#L293):\r\n\r\n```Go\r\nif c := w.Stat().Name()[0]; c == '.' || c == '_' {\r\n\t// Skip directories using a rule similar to how\r\n\t// the go tool enumerates packages.\r\n\t// See $GOROOT/src/cmd/go/main.go:/matchPackagesInFs\r\n\tw.SkipDir()\r\n}\r\n```\r\n\r\nBut `$GOROOT/src/cmd/go/main.go:/matchPackagesInFs` in Go 1.3.3 has:\r\n\r\n```Go\r\n// Avoid .foo, _foo, and testdata directory trees, but do not avoid \".\" or \"..\".\r\n_, elem := filepath.Split(path)\r\ndot := strings.HasPrefix(elem, \".\") && elem != \".\" && elem != \"..\"\r\nif dot || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\r\n\treturn filepath.SkipDir\r\n}\r\n```\r\n\r\nNotably, it skips the \"testdata\" folder. ~~`godep` should do the same.~~ The \"testdata\" folder is sometimes used to have invalid .go code files (e.g., for testing the Go parser) and other such things inside, which may prevent otherwise valid Go packages from working with `godep`.\r\n\r\nThe behavior of `go` tool skipping \"testdata\" folders has been recently documented, see https://codereview.appspot.com/148170043.\r\n\r\n**Edit:** This is out of date. See https://github.com/tools/godep/pull/166#issuecomment-107355561 for my latest suggested fix:\r\n\r\n> I think what it fixes is a symptom, not the real cause. It should be okay to vendor `testdata` folders, the issue is that they shouldn't be navigated into when listing Go packages and causing errors since `testdata` folders may purposefully (correctly) contain .go files that are invalid Go code."},"comment":{"url":"https://api.github.com/repos/tools/godep/issues/comments/136455809","html_url":"https://github.com/tools/godep/issues/140#issuecomment-136455809","issue_url":"https://api.github.com/repos/tools/godep/issues/140","id":136455809,"user":{"login":"neurogeek","id":243474,"avatar_url":"https://avatars.githubusercontent.com/u/243474?v=3","gravatar_id":"","url":"https://api.github.com/users/neurogeek","html_url":"https://github.com/neurogeek","followers_url":"https://api.github.com/users/neurogeek/followers","following_url":"https://api.github.com/users/neurogeek/following{/other_user}","gists_url":"https://api.github.com/users/neurogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/neurogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neurogeek/subscriptions","organizations_url":"https://api.github.com/users/neurogeek/orgs","repos_url":"https://api.github.com/users/neurogeek/repos","events_url":"https://api.github.com/users/neurogeek/events{/privacy}","received_events_url":"https://api.github.com/users/neurogeek/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T18:32:30Z","updated_at":"2015-08-31T18:32:30Z","body":"Yes, I'm working on a better fix. I'll send it out for review in the next couple of days."}}