aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/coderepo.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-06-24 10:16:12 -0400
committerBryan C. Mills <bcmills@google.com>2019-06-24 18:27:20 +0000
commit43e53beba53547f2846a18e373c9205ededc20d2 (patch)
tree2451b915a7daac56d56fb22a9e3bb97d812f6648 /src/cmd/go/internal/modfetch/coderepo.go
parentfafc92d4a6756c00683513a21a8f055b01595792 (diff)
downloadgo-43e53beba53547f2846a18e373c9205ededc20d2.tar.gz
go-43e53beba53547f2846a18e373c9205ededc20d2.zip
cmd/go/internal/modfetch: treat a missing go.mod file as a “not exist” error
If we have found a repository at the requested version but it does not contain a go.mod file in an appropriate subdirectory, then the module with the given path does not exist at that version. Therefore, we should report it with an error equivalent to os.ErrNotExist so that modload.Query will continue to check other possible module paths. Updates #27173 Change-Id: Ica73f4bb97f58e611a7f7d38183ee52fef5ee69a Reviewed-on: https://go-review.googlesource.com/c/go/+/183618 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/coderepo.go')
-rw-r--r--src/cmd/go/internal/modfetch/coderepo.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go
index 45243681f8..267b76349d 100644
--- a/src/cmd/go/internal/modfetch/coderepo.go
+++ b/src/cmd/go/internal/modfetch/coderepo.go
@@ -255,7 +255,13 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e
if err != nil {
// TODO: It would be nice to return an error like "not a module".
// Right now we return "missing go.mod", which is a little confusing.
- return nil, err
+ return nil, &module.ModuleError{
+ Path: r.modPath,
+ Err: &module.InvalidVersionError{
+ Version: info2.Version,
+ Err: notExistError(err.Error()),
+ },
+ }
}
}