tools / godep

dependency tool for go
http://godoc.org/github.com/tools/godep
BSD 3-Clause "New" or "Revised" License
5.54k stars 454 forks source link

godep fails to vendor golang.org/x/tools/go/loader #187

Open peterwald opened 9 years ago

peterwald commented 9 years ago

When running godep save on a project that includes a reference to golang.org/x/tools/go/loader, godep does not copy the files in the go/loader package.

The following error is returned from the command line.

godep: Godeps/_workspace/src/golang.org/x/tools/go/loader/testdata/badpkgdecl.go:1:34: expected 'package', found 'EOF' 

This appears to be because there is a test file in that package that is deliberately missing the package statement, and godep fails to parse it. go/loader/testdata/badpkgdecl.go

Rather than failing to copy the entire package, godep should skip parsing this file on error (i.e. not discovering any imports) and move along, successfully vendoring the package.

Reference issue sourcegraph/srclib-go#30.

ghost commented 9 years ago

Related: https://github.com/tools/godep/issues/140#issuecomment-98222302 Fix: https://github.com/tools/godep/pull/166

neurogeek commented 9 years ago

Fix is in to ignore testdata. That should help with this issue.

freeformz commented 9 years ago

@neurogeek I would rather say that testdata files should just be copied over as is w/o attempting to parse. This is especially true as we move to the use of vendor/ and some of the discussions I've seen crop up around testing vendored code.

neurogeek commented 9 years ago

Cool. I'll revisit the solution then.