{"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":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-10-28T07:13:27Z","updated_at":"2015-05-01T20:10:19Z","closed_at":null,"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\n\tif c := w.Stat().Name()[0]; c == '.' || c == '_' {\r\n\t\t// Skip directories using a rule similar to how\r\n\t\t// the go tool enumerates packages.\r\n\t\t// See $GOROOT/src/cmd/go/main.go:/matchPackagesInFs\r\n\t\tw.SkipDir()\r\n\t}\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\t\t// Avoid .foo, _foo, and testdata directory trees, but do not avoid \".\" or \"..\".\r\n\t\t_, elem := filepath.Split(path)\r\n\t\tdot := strings.HasPrefix(elem, \".\") && elem != \".\" && elem != \"..\"\r\n\t\tif dot || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\r\n\t\t\treturn filepath.SkipDir\r\n\t\t}\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."},"comment":{"url":"https://api.github.com/repos/tools/godep/issues/comments/98222302","html_url":"https://github.com/tools/godep/issues/140#issuecomment-98222302","issue_url":"https://api.github.com/repos/tools/godep/issues/140","id":98222302,"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-05-01T20:10:19Z","updated_at":"2015-05-01T20:10:19Z","body":"This issue prevents godep from working in some cases:\r\n\r\n```bash\r\n$ godep save\r\ngodep: Godeps/_workspace/src/golang.org/x/tools/go/loader/testdata/badpkgdecl.go:1:34: expected 'package', found 'EOF'\r\n```\r\n\r\nIt should not be reading .go files inside testdata folder!"}}