]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: reject some bad module paths
authorMichael Matloob <matloob@golang.org>
Mon, 16 Dec 2019 22:18:06 +0000 (17:18 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 26 Aug 2020 21:35:30 +0000 (21:35 +0000)
commit694fc8e76bec99b67bbd0302852f6a1c1dafe7ca
tree03313f774fb60043129d63a7c3d4b44068c7fbbb
parent008048c5f4613c6b864c2e69ce795df9fa227e63
cmd/go/internal/modload: reject some bad module paths

This change rejects module paths that don't conform to
the new checkModulePathLax function, when loading a go.mod
file. The change uses the checkModulePathLax function instead of
CheckPath because there are still many users who are using
unpublished modules with unpublishable paths, and we don't
want to break them all.

Next, before this change, when go mod init is run in GOPATH,
it would try to use the location of the directory within GOPATH
to infer the module path. After this change, it will only use
that inferred module path if it conforms to module.CheckPath.

Change-Id: Idb36d1655cc76aae82671e87ba634609503ad1a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/211597
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_invalid_path.txt