Preserve replacement selectors during recovery
This commit is contained in:
@@ -100,9 +100,11 @@ func RecoveryTool(ctx context.Context, moduleDir, recordDir string) (*RecoveryIn
|
||||
// replacements relative to the directory that originally owned go.mod.
|
||||
for _, replacement := range module.Replace {
|
||||
if replacement.New.Version == "" && !filepath.IsAbs(replacement.New.Path) {
|
||||
if err := module.AddReplace(replacement.Old.Path, replacement.Old.Version, filepath.Join(moduleDir, replacement.New.Path), ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// A local replacement ends in its path token. Edit that token on
|
||||
// the parsed directive so a wildcard does not absorb versioned ones.
|
||||
replacement.New.Path = filepath.Join(moduleDir, replacement.New.Path)
|
||||
tokens := replacement.Syntax.Token
|
||||
tokens[len(tokens)-1] = modfile.AutoQuote(replacement.New.Path)
|
||||
}
|
||||
}
|
||||
// The original main module's source remains local if a dependency refers
|
||||
|
||||
Reference in New Issue
Block a user