@@ -12,7 +12,6 @@ import (
12
12
"context"
13
13
"fmt"
14
14
"os"
15
- "reflect"
16
15
"runtime"
17
16
"strings"
18
17
"sync"
@@ -455,71 +454,6 @@ func EditBuildList(ctx context.Context, add, mustSelect []module.Version) (chang
455
454
return changed , err
456
455
}
457
456
458
- func editRequirements (ctx context.Context , rs * Requirements , add , mustSelect []module.Version ) (edited * Requirements , changed bool , err error ) {
459
- mg , err := rs .Graph (ctx )
460
- if err != nil {
461
- return nil , false , err
462
- }
463
- buildList := mg .BuildList ()
464
-
465
- final , err := editBuildList (ctx , buildList , add , mustSelect )
466
- if err != nil {
467
- return nil , false , err
468
- }
469
-
470
- if ! reflect .DeepEqual (final , buildList ) {
471
- changed = true
472
- } else if len (mustSelect ) == 0 {
473
- // No change to the build list and no explicit roots to promote, so we're done.
474
- return rs , false , nil
475
- }
476
-
477
- var rootPaths []string
478
- for _ , m := range mustSelect {
479
- if m .Version != "none" && m .Path != Target .Path {
480
- rootPaths = append (rootPaths , m .Path )
481
- }
482
- }
483
- for _ , m := range final [1 :] {
484
- if v , ok := rs .rootSelected (m .Path ); ok && (v == m .Version || rs .direct [m .Path ]) {
485
- // m.Path was formerly a root, and either its version hasn't changed or
486
- // we believe that it provides a package directly imported by a package
487
- // or test in the main module. For now we'll assume that it is still
488
- // relevant. If we actually load all of the packages and tests in the
489
- // main module (which we are not doing here), we can revise the explicit
490
- // roots at that point.
491
- rootPaths = append (rootPaths , m .Path )
492
- }
493
- }
494
-
495
- if go117LazyTODO {
496
- // mvs.Req is not lazy, and in a lazily-loaded module we don't want
497
- // to minimize the roots anyway. (Instead, we want to retain explicit
498
- // root paths so that they remain explicit: only 'go mod tidy' should
499
- // remove roots.)
500
- }
501
-
502
- min , err := mvs .Req (Target , rootPaths , & mvsReqs {roots : final [1 :]})
503
- if err != nil {
504
- return nil , false , err
505
- }
506
-
507
- // A module that is not even in the build list necessarily cannot provide
508
- // any imported packages. Mark as direct only the direct modules that are
509
- // still in the build list.
510
- //
511
- // TODO(bcmills): Would it make more sense to leave the direct map as-is
512
- // but allow it to refer to modules that are no longer in the build list?
513
- // That might complicate updateRoots, but it may be cleaner in other ways.
514
- direct := make (map [string ]bool , len (rs .direct ))
515
- for _ , m := range final {
516
- if rs .direct [m .Path ] {
517
- direct [m .Path ] = true
518
- }
519
- }
520
- return newRequirements (rs .depth , min , direct ), changed , nil
521
- }
522
-
523
457
// A ConstraintError describes inconsistent constraints in EditBuildList
524
458
type ConstraintError struct {
525
459
// Conflict lists the source of the conflict for each version in mustSelect
0 commit comments