mirror of
https://github.com/golang/go
synced 2024-11-26 13:08:08 -07:00
cmd/go: fix go.mod file name printed in error messages for replacements
This fixes a logic error introduced in CL 337850. Fixes #47444 Change-Id: I6a49c8fc71fdde4ecb7f2e3329ad1f2cd286b7eb Reviewed-on: https://go-review.googlesource.com/c/go/+/338189 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Trust: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
b39e0f461c
commit
9eee0ed439
@ -652,8 +652,8 @@ func rawGoModData(m module.Version) (name string, data []byte, err error) {
|
||||
if !filepath.IsAbs(dir) {
|
||||
dir = filepath.Join(ModRoot(), dir)
|
||||
}
|
||||
gomod := filepath.Join(dir, "go.mod")
|
||||
if gomodActual, ok := fsys.OverlayPath(gomod); ok {
|
||||
name = filepath.Join(dir, "go.mod")
|
||||
if gomodActual, ok := fsys.OverlayPath(name); ok {
|
||||
// Don't lock go.mod if it's part of the overlay.
|
||||
// On Plan 9, locking requires chmod, and we don't want to modify any file
|
||||
// in the overlay. See #44700.
|
||||
@ -662,16 +662,17 @@ func rawGoModData(m module.Version) (name string, data []byte, err error) {
|
||||
data, err = lockedfile.Read(gomodActual)
|
||||
}
|
||||
if err != nil {
|
||||
return gomod, nil, module.VersionError(m, fmt.Errorf("reading %s: %v", base.ShortPath(gomod), err))
|
||||
return "", nil, module.VersionError(m, fmt.Errorf("reading %s: %v", base.ShortPath(name), err))
|
||||
}
|
||||
} else {
|
||||
if !semver.IsValid(m.Version) {
|
||||
// Disallow the broader queries supported by fetch.Lookup.
|
||||
base.Fatalf("go: internal error: %s@%s: unexpected invalid semantic version", m.Path, m.Version)
|
||||
}
|
||||
name = "go.mod"
|
||||
data, err = modfetch.GoMod(m.Path, m.Version)
|
||||
}
|
||||
return "go.mod", data, err
|
||||
return name, data, err
|
||||
}
|
||||
|
||||
// queryLatestVersionIgnoringRetractions looks up the latest version of the
|
||||
|
Loading…
Reference in New Issue
Block a user