diff options
author | Jay Conrod <jayconrod@google.com> | 2019-10-09 17:49:17 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2019-10-11 18:16:37 +0000 |
commit | 78d67164bb6bd95031d109d959900c196cfa3029 (patch) | |
tree | f710b6b0e9b482ca90ec583ab6b98daf22839f69 /src/cmd/go/internal/modfetch/coderepo.go | |
parent | 2686e7494845dae877e0efb4ff786c672b2cd2ef (diff) | |
download | go-78d67164bb6bd95031d109d959900c196cfa3029.tar.gz go-78d67164bb6bd95031d109d959900c196cfa3029.zip |
cmd/go: integrate changes made in x/mod packages into internal packages
This change integrates changes made to x/mod packages into our internal
copies of those packages.
This is the first step of a bidirectional synchronization. A follow-up
change will copy changes made to the internal packages after x/mod was
forked. After that, we can vendor x/mod, update imports, and delete
the internal copies.
The following packages are affected:
* internal/module
* internal/semver (no change)
* internal/sumweb (renamed to internal/sumdb)
* internal/dirhash
* internal/note
* internal/tlog
Several integrated changes affect other packages:
* cmd/go/internal/module.MatchPathMajor now wraps a new function,
CheckPathMajor, which returns error. MatchPathMajor returns
bool. This will avoid an incompatible change in the next step.
* module.EncodePath renamed to EscapePath, EncodeVersion to
EscapeVersion, DecodePath to UnescapePath, DecodeVersion to
UnescapeVersion.
* cmd/go/internal/sumweb moved to cmd/go/internal/sumdb and package
renamed to sumdb.
* sumdb.Client renamed to ClientOps, Conn to Client, Server to
ServerOps, Paths to ServerPaths.
* sumdb/encode.go and encode_test.go are not present in x/mod since
they are redundant with functionality in module. Both files are
deleted.
* sumdb.TestServer doesn't implement sumdb.ServerOps after changes
were were made to golang.org/x/mod/sumdb.ServerOps during the fork.
Local changes made so tests will pass. These will be copied to x/mod
in the next step.
Updates #34801
Change-Id: I7e820f10ae0cdbec238e59d039e978fd1cdc7201
Reviewed-on: https://go-review.googlesource.com/c/go/+/200138
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/coderepo.go')
-rw-r--r-- | src/cmd/go/internal/modfetch/coderepo.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go index 541d856b28..588f7a8d67 100644 --- a/src/cmd/go/internal/modfetch/coderepo.go +++ b/src/cmd/go/internal/modfetch/coderepo.go @@ -159,7 +159,7 @@ func (r *codeRepo) Versions(prefix string) ([]string, error) { if v == "" || v != module.CanonicalVersion(v) || IsPseudoVersion(v) { continue } - if err := module.MatchPathMajor(v, r.pathMajor); err != nil { + if err := module.CheckPathMajor(v, r.pathMajor); err != nil { if r.codeDir == "" && r.pathMajor == "" && semver.Major(v) > "v1" { incompatible = append(incompatible, v) } @@ -293,7 +293,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e } } - if err := module.MatchPathMajor(strings.TrimSuffix(info2.Version, "+incompatible"), r.pathMajor); err == nil { + if err := module.CheckPathMajor(strings.TrimSuffix(info2.Version, "+incompatible"), r.pathMajor); err == nil { return nil, invalidf("+incompatible suffix not allowed: major version %s is compatible", semver.Major(info2.Version)) } } @@ -317,7 +317,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e return checkGoMod() } - if err := module.MatchPathMajor(info2.Version, r.pathMajor); err != nil { + if err := module.CheckPathMajor(info2.Version, r.pathMajor); err != nil { if canUseIncompatible() { info2.Version += "+incompatible" return checkGoMod() @@ -365,7 +365,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e tagIsCanonical = true } - if err := module.MatchPathMajor(v, r.pathMajor); err != nil { + if err := module.CheckPathMajor(v, r.pathMajor); err != nil { if canUseIncompatible() { return v + "+incompatible", tagIsCanonical } @@ -464,7 +464,7 @@ func (r *codeRepo) validatePseudoVersion(info *codehost.RevInfo, version string) } }() - if err := module.MatchPathMajor(version, r.pathMajor); err != nil { + if err := module.CheckPathMajor(version, r.pathMajor); err != nil { return err } |