hundreds-father-404
10/11/2021, 7:09 PM./pants test src/go/foo_test.py
as a way to test all of src/go
. It's natural to use ./pants test src/go
. 🧵path/to/dir
is currently shorthand for path/to/dir:dir
. That applies to both CLI args and BUILD files with dependencies
field etc. https://github.com/pantsbuild/pants/issues/12286 discusses removing that shorthand entirely, but it got stuck in discussion about whether to always require name=
vs. make target generators be address-less vs. other ideas. That will require a lot more design to resolve, they're big changes
Instead, @fast-nail-55400 and I are thinking that we should punt on the bigger question about what to do with name=
, and go ahead fixing CLI specs. BUILD files will still (for now) use the shorthand, but we add an option so that CLI specs no longer treat dirs as target addresses
Thoughts on decoupling the CLI specs change from the bigger discussion?witty-crayon-22786
10/11/2021, 7:11 PM./pants test src/go
work via default targets?go
is not recursive by default, so defaulting to recursive as https://github.com/pantsbuild/pants/issues/12286 suggests would actually diverge from `go`’s behavior (while aligning with `git`’s)hundreds-father-404
10/11/2021, 7:14 PMshouldn’t ./pants test src/go work via default targets?No because the
spec_path
of generated targets is the target generator's 😐 And "fixing" that would be really hard to land. It would break our Address -> WrappedTarget
, which requires knowing the Address of the target generator - if we no longer have that Address, we have to start using Specs
in the Address -> WrappedTarget
rulewitty-crayon-22786
10/11/2021, 7:15 PMNo because thesure, but it will match the generator, which depends on the generated targets, right?of generated targets is the target generator’sspec_path
hundreds-father-404
10/11/2021, 7:15 PMgo is not recursive by default, so defaulting to recursive as https://github.com/pantsbuild/pants/issues/12286 suggests would actually diverge from go’s behavior (while aligning with git’s)Yep, whether dir specs should be recursive or not is a separate, related question. I think we should keep that to a separate thread. Here, only focus on "Should we implement directory specs before we figure out what to do with
name=
and address-target generators?"witty-crayon-22786
10/11/2021, 7:17 PMhundreds-father-404
10/11/2021, 7:17 PMsure, but it will match the generator, which depends on the generated targets, right?Not quite. Let's say you have
<root>/go.mod
and dir/foo_test.go
. You'll have the generated target //:mod#./dir
.
When you say ./pants test dir
, that will look look for a target called dir:dir
, which does not existwitty-crayon-22786
10/11/2021, 7:17 PMhundreds-father-404
10/11/2021, 7:19 PMsrc/go/go.mod
and src/go/dir/foo_test.go
. You have a generated target src/go#./dir
. Specificying ./pants test src/go/dir
looks for src/go/dir:dir
, and failsOwners
of src/go/dir/*
(or src/go/dir**/*
if we use recursive specs), and it will workwitty-crayon-22786
10/11/2021, 7:21 PMYou have a generated targetshouldn’t the generator have the default name in this case? why would it be named?. Specificyingsrc/go#./dir
looks for./pants test src/go/dir
, and failssrc/go/dir:dir
hundreds-father-404
10/11/2021, 7:22 PMdir/
is shorthand either for dir/*
or dir/**/*
, depending on how we approach recursion
Like file specs, it uses Owners
code pathwitty-crayon-22786
10/11/2021, 7:23 PMSpecs
work so that they can also match generated targetshundreds-father-404
10/11/2021, 7:28 PM./pants test src/go/dir::
, which is totally broken if your go_mod
is in src/go
. That is, "address specs". That will be important to figure out, but I think is a much harder problem
I'm talking about the behavior of ./pants test src/go/dir
. No longer meaning dir:dir
(address spec), and instead all targets (that own sources?) in dir
, and possibly subdirs (filesystem spec)happy-kitchen-89482
10/11/2021, 7:35 PMThoughts on decoupling the CLI specs change from the bigger discussion?
hundreds-father-404
10/11/2021, 7:37 PMwitty-crayon-22786
10/11/2021, 7:39 PMhundreds-father-404
10/11/2021, 7:42 PMhappy-kitchen-89482
10/12/2021, 12:11 AMhundreds-father-404
10/12/2021, 4:06 PM