Pants: golang targets should accept resources

Created on 20 Jan 2016  路  2Comments  路  Source: pantsbuild/pants

We want to run tests against known files. In JVM, these would be resources. golang has no way to specify these.

One workaround is to create a go_library for each testdata directory. This is doable, but cumbersome (it requires a 1-line BUILD file, a 1-line go file (because a go_library requires at least one go source file), and 1 dependency per testdata directory). It gets more expensive if you want to test, e.g., directory structures, and want to have many directories (because the glob for finding sources is non-recursive).

It breaks if the file we want to test against happens to end with the extension .c, because it complains "can't load package: package twitter.biz/scoot/git/bytes/test_data: C source files not allowed when not using cgo or SWIG: test-delta-new.c test-delta.c zlib-changed.c zlib.c ".

Well, yes, we don't want these as source.

It would be preferable if go_* accepted testdata as files that are not compiled, but are included in the symlink forest created for running tests.

All 2 comments

Looks like this is a dupe of #2819

I believe this should work by creating a resources target and including it in the dependencies field of the Go target. But in case it doesn't:

We recently decided to focus our energy on the release of Pants 2.0, which only works with the new v2 engine.

This means that Pants 2.0 will not support Go at first, as we're initially focused on a stellar Python experience. Users may continue to use the Pants 1.x plugin. We also plan to rebuild Go support from the ground-up in the future (timeline will be determined by user interest).

I'm closing this as we, unfortunately, won't likely get to fixing it in Pants 1.x.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pierrechevalier83 picture pierrechevalier83  路  4Comments

pvcnt picture pvcnt  路  3Comments

jsirois picture jsirois  路  3Comments

stuhood picture stuhood  路  6Comments

cosmicexplorer picture cosmicexplorer  路  8Comments