In bazel land if I have these targets ```//path/to...
# general
p
In bazel land if I have these targets
Copy code
//path/to/thing:thing
//path/to/thing:thing_helper
bazel run //path/to/thing
works. As far as I can tell, pants works this way to.. if the target name matches the directory name it defaults. Though, if you have more than one target in a BUILD file I am seeing this exception
Copy code
TooManyTargetsException: The `run` goal only works with one valid target, but was given multiple valid targets:

  * third_party/balena:balena
  * third_party/balena:login
So question: Can I tell pants to do what I want? default to balena:balena if multiple targets?
e
You left out the command line you used to get that error.
p
Sorry
Copy code
pants run third_party/balena -- --version
16:18:50.12 [ERROR] 1 Exception encountered:

Engine traceback:
  in `run` goal

TooManyTargetsException: The `run` goal only works with one valid target, but was given multiple valid targets:

  * third_party/balena:balena
  * third_party/balena:login

Please select one of these targets to run.
e
Hrm, that looks like a bug to me.
p
Copy code
pants run third_party/balena:balena -- -version
works as expected.
e
A trailing
:
is supposed to be required to glob, which should lead to your error. No trailing
:
should not be globbing, it should expand to your working CLI internally... or else the default target concept means nothing.
b
I think pants switched from
foo/bar
=
foo/bar:bar
to
foo/bar
=
foo/bar:
in 2.13 (https://github.com/pantsbuild/pants/pull/15589 / https://github.com/pantsbuild/pants/issues/14209).
(https://github.com/pantsbuild/pants/issues/12286 is also related, to "the default target concept means nothing")
p
Not sure if it matters.. if I remove the login target
third_party/balena
does the right thing.
b
I imagine that'll be the glob expanding to one target, instead of expanding to two
p
I see..
e
Hrm. Ok. Yeah - Pants is very thrashy! TIL.