@@ -318,22 +318,41 @@ func (c *Client) Get(args ...string) error {
318
318
patch := update && (args [0 ] == "-u=patch" ) //
319
319
320
320
// We need to be explicit about the modules to get.
321
- for _ , m := range c .moduleConfig .Imports {
322
- if ! isProbablyModule (m .Path ) {
323
- // Skip themes/components stored below /themes etc.
324
- // There may be false positives in the above, but those
325
- // should be rare, and they will fail below with an
326
- // "cannot find module providing ..." message.
327
- continue
321
+ var modules []string
322
+ // Update all active modules if the -u flag presents.
323
+ if update {
324
+ mc , coll := c .collect (true )
325
+ if coll .err != nil {
326
+ return coll .err
328
327
}
328
+ for _ , m := range mc .AllModules {
329
+ if m .Owner () == nil {
330
+ continue
331
+ }
332
+ modules = append (modules , m .Path ())
333
+ }
334
+ } else {
335
+ for _ , m := range c .moduleConfig .Imports {
336
+ if ! isProbablyModule (m .Path ) {
337
+ // Skip themes/components stored below /themes etc.
338
+ // There may be false positives in the above, but those
339
+ // should be rare, and they will fail below with an
340
+ // "cannot find module providing ..." message.
341
+ continue
342
+ }
343
+ modules = append (modules , m .Path )
344
+ }
345
+ }
346
+
347
+ for _ , m := range modules {
329
348
var args []string
330
349
331
350
if update && ! patch {
332
351
args = append (args , "-u" )
333
352
} else if update && patch {
334
353
args = append (args , "-u=patch" )
335
354
}
336
- args = append (args , m . Path )
355
+ args = append (args , m )
337
356
338
357
if err := c .get (args ... ); err != nil {
339
358
return err
0 commit comments