File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -494,15 +494,21 @@ func extract(workspace project.GoWorkspace) {
494494 if workspace .DepMode == project .GoGetWithModules {
495495 extractorArgs = append (extractorArgs , workspace .ModMode .ArgsForGoVersion (toolchain .GetEnvGoSemVer ())... )
496496 }
497- for _ , module := range workspace .Modules {
498- relModPath , relErr := filepath .Rel (workspace .BaseDir , filepath .Dir (module .Path ))
499497
500- if relErr != nil {
501- log .Printf (
502- "Unable to make module path %s relative to workspace base dir %s: %s\n " ,
503- filepath .Dir (module .Path ), workspace .BaseDir , relErr .Error ())
504- } else {
505- extractorArgs = append (extractorArgs , relModPath )
498+ if len (workspace .Modules ) == 0 {
499+ // There may be no modules if we are using e.g. Dep or Glide
500+ extractorArgs = append (extractorArgs , "./..." )
501+ } else {
502+ for _ , module := range workspace .Modules {
503+ relModPath , relErr := filepath .Rel (workspace .BaseDir , filepath .Dir (module .Path ))
504+
505+ if relErr != nil {
506+ log .Printf (
507+ "Unable to make module path %s relative to workspace base dir %s: %s\n " ,
508+ filepath .Dir (module .Path ), workspace .BaseDir , relErr .Error ())
509+ } else {
510+ extractorArgs = append (extractorArgs , relModPath )
511+ }
506512 }
507513 }
508514
You can’t perform that action at this time.
0 commit comments