@@ -191,6 +191,16 @@ func packagesToResponse(rootpath string, pkgs []*packages.Package, dirs map[stri
191191 }, nil
192192}
193193
194+ func plz (args ... string ) * exec.Cmd {
195+ cmd := exec .Command ("plz" , args ... )
196+ if term .IsTerminal (int (os .Stderr .Fd ())) {
197+ cmd .Stderr = & bytes.Buffer {}
198+ } else {
199+ cmd .Stderr = os .Stderr
200+ }
201+ return cmd
202+ }
203+
194204func findFile (rootpath , file string ) string {
195205 if pathExists (file ) {
196206 return filepath .Join (rootpath , file )
@@ -220,16 +230,6 @@ func loadPackageInfo(files []string, mode packages.LoadMode) ([]*packages.Packag
220230 if len (files ) == 0 {
221231 return []* packages.Package {}, nil
222232 }
223- isTerminal := term .IsTerminal (int (os .Stderr .Fd ()))
224- plz := func (args ... string ) * exec.Cmd {
225- cmd := exec .Command ("plz" , args ... )
226- if ! isTerminal {
227- cmd .Stderr = & bytes.Buffer {}
228- } else {
229- cmd .Stderr = os .Stderr
230- }
231- return cmd
232- }
233233
234234 r1 , w1 , err := os .Pipe ()
235235 if err != nil {
@@ -362,6 +362,12 @@ func handleSubprocessErr(cmd *exec.Cmd, err error) error {
362362// directoriesToFiles expands any directories in the given list to files in that directory.
363363func directoriesToFiles (in []string , includeTests bool ) ([]string , error ) {
364364 files := make ([]string , 0 , len (in ))
365+ experimentalCmd := plz ("query" , "config" , "parse.ExperimentalDir" )
366+ experimentalDir , err := experimentalCmd .Output ()
367+ if err != nil {
368+ return nil , handleSubprocessErr (experimentalCmd , err )
369+ }
370+
365371 for _ , x := range in {
366372 if strings .HasSuffix (x , "/..." ) {
367373 // We could turn this into a `/...` style thing for plz but we also need to know the
@@ -370,7 +376,7 @@ func directoriesToFiles(in []string, includeTests bool) ([]string, error) {
370376 if err != nil {
371377 return err
372378 }
373- if d .Name () == "plz-out" {
379+ if d .Name () == "plz-out" || d . Name () == strings . TrimSpace ( string ( experimentalDir )) {
374380 return filepath .SkipDir
375381 }
376382 if strings .HasSuffix (path , ".go" ) && (d .Type ()& fs .ModeSymlink ) == 0 {
0 commit comments