aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2021-11-15 16:19:29 -0500
committerMichael Matloob <matloob@golang.org>2021-11-16 17:32:23 +0000
commit40effca7a13d11f3549a24a5d4b02e87c12fc6bb (patch)
tree2c00e91c69691fc3fdbd6c2462084fdc6bc900c2 /src/cmd/vendor
parent29ec902efc0ae53c4435097efdb738667466756c (diff)
downloadgo-40effca7a13d11f3549a24a5d4b02e87c12fc6bb.tar.gz
go-40effca7a13d11f3549a24a5d4b02e87c12fc6bb.zip
cmd: pull in golang.org/x/mod@3a5865c
This change updates the cmd module's requirement on x/mod and vendors in the changes. This pulls in the following changes into our vendored copy of x/mod: golang.org/cl/351319: module: accept trailing slash in MatchPrefixPattern golang.org/cl/353749: semver: remove unused err field golang.org/cl/355630: x/mod: update requirement on x/crypto golang.org/cl/359412: modfile: rename directory directive to use Changes have been made in cmd/go renaming all uses of directory to use and fixing references to functions in x/mod/modfile to account for the changes in the last of thse CLs. For #45713 Change-Id: I9121d08f6e6b11838bca50e6cbd756baeeae867b Reviewed-on: https://go-review.googlesource.com/c/go/+/364114 Trust: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/vendor')
-rw-r--r--src/cmd/vendor/golang.org/x/mod/modfile/rule.go4
-rw-r--r--src/cmd/vendor/golang.org/x/mod/modfile/work.go50
-rw-r--r--src/cmd/vendor/golang.org/x/mod/module/module.go2
-rw-r--r--src/cmd/vendor/golang.org/x/mod/semver/semver.go10
-rw-r--r--src/cmd/vendor/modules.txt2
5 files changed, 30 insertions, 38 deletions
diff --git a/src/cmd/vendor/golang.org/x/mod/modfile/rule.go b/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
index 98211a450a..ed2f31aa70 100644
--- a/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
+++ b/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
@@ -609,7 +609,7 @@ func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string,
f.Go = &Go{Syntax: line}
f.Go.Version = args[0]
- case "directory":
+ case "use":
if len(args) != 1 {
errorf("usage: %s local/dir", verb)
return
@@ -619,7 +619,7 @@ func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string,
errorf("invalid quoted string: %v", err)
return
}
- f.Directory = append(f.Directory, &Directory{
+ f.Use = append(f.Use, &Use{
Path: s,
Syntax: line,
})
diff --git a/src/cmd/vendor/golang.org/x/mod/modfile/work.go b/src/cmd/vendor/golang.org/x/mod/modfile/work.go
index b1fabff51b..0c0e521525 100644
--- a/src/cmd/vendor/golang.org/x/mod/modfile/work.go
+++ b/src/cmd/vendor/golang.org/x/mod/modfile/work.go
@@ -12,16 +12,16 @@ import (
// A WorkFile is the parsed, interpreted form of a go.work file.
type WorkFile struct {
- Go *Go
- Directory []*Directory
- Replace []*Replace
+ Go *Go
+ Use []*Use
+ Replace []*Replace
Syntax *FileSyntax
}
-// A Directory is a single directory statement.
-type Directory struct {
- Path string // Directory path of module.
+// A Use is a single directory statement.
+type Use struct {
+ Path string // Use path of module.
ModulePath string // Module path in the comment.
Syntax *Line
}
@@ -67,7 +67,7 @@ func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) {
Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")),
})
continue
- case "directory", "replace":
+ case "use", "replace":
for _, l := range x.Line {
f.add(&errs, l, x.Token[0], l.Token, fix)
}
@@ -87,13 +87,13 @@ func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) {
// Cleanup cleans out all the cleared entries.
func (f *WorkFile) Cleanup() {
w := 0
- for _, r := range f.Directory {
+ for _, r := range f.Use {
if r.Path != "" {
- f.Directory[w] = r
+ f.Use[w] = r
w++
}
}
- f.Directory = f.Directory[:w]
+ f.Use = f.Use[:w]
w = 0
for _, r := range f.Replace {
@@ -133,60 +133,60 @@ func (f *WorkFile) AddGoStmt(version string) error {
return nil
}
-func (f *WorkFile) AddDirectory(diskPath, modulePath string) error {
+func (f *WorkFile) AddUse(diskPath, modulePath string) error {
need := true
- for _, d := range f.Directory {
+ for _, d := range f.Use {
if d.Path == diskPath {
if need {
d.ModulePath = modulePath
- f.Syntax.updateLine(d.Syntax, "directory", AutoQuote(diskPath))
+ f.Syntax.updateLine(d.Syntax, "use", AutoQuote(diskPath))
need = false
} else {
d.Syntax.markRemoved()
- *d = Directory{}
+ *d = Use{}
}
}
}
if need {
- f.AddNewDirectory(diskPath, modulePath)
+ f.AddNewUse(diskPath, modulePath)
}
return nil
}
-func (f *WorkFile) AddNewDirectory(diskPath, modulePath string) {
- line := f.Syntax.addLine(nil, "directory", AutoQuote(diskPath))
- f.Directory = append(f.Directory, &Directory{Path: diskPath, ModulePath: modulePath, Syntax: line})
+func (f *WorkFile) AddNewUse(diskPath, modulePath string) {
+ line := f.Syntax.addLine(nil, "use", AutoQuote(diskPath))
+ f.Use = append(f.Use, &Use{Path: diskPath, ModulePath: modulePath, Syntax: line})
}
-func (f *WorkFile) SetDirectory(dirs []*Directory) {
+func (f *WorkFile) SetUse(dirs []*Use) {
need := make(map[string]string)
for _, d := range dirs {
need[d.Path] = d.ModulePath
}
- for _, d := range f.Directory {
+ for _, d := range f.Use {
if modulePath, ok := need[d.Path]; ok {
d.ModulePath = modulePath
} else {
d.Syntax.markRemoved()
- *d = Directory{}
+ *d = Use{}
}
}
// TODO(#45713): Add module path to comment.
for diskPath, modulePath := range need {
- f.AddNewDirectory(diskPath, modulePath)
+ f.AddNewUse(diskPath, modulePath)
}
f.SortBlocks()
}
-func (f *WorkFile) DropDirectory(path string) error {
- for _, d := range f.Directory {
+func (f *WorkFile) DropUse(path string) error {
+ for _, d := range f.Use {
if d.Path == path {
d.Syntax.markRemoved()
- *d = Directory{}
+ *d = Use{}
}
}
return nil
diff --git a/src/cmd/vendor/golang.org/x/mod/module/module.go b/src/cmd/vendor/golang.org/x/mod/module/module.go
index 89bd3ede27..355b5a4568 100644
--- a/src/cmd/vendor/golang.org/x/mod/module/module.go
+++ b/src/cmd/vendor/golang.org/x/mod/module/module.go
@@ -798,6 +798,7 @@ func unescapeString(escaped string) (string, bool) {
// GOPRIVATE environment variable, as described by 'go help module-private'.
//
// It ignores any empty or malformed patterns in the list.
+// Trailing slashes on patterns are ignored.
func MatchPrefixPatterns(globs, target string) bool {
for globs != "" {
// Extract next non-empty glob in comma-separated list.
@@ -807,6 +808,7 @@ func MatchPrefixPatterns(globs, target string) bool {
} else {
glob, globs = globs, ""
}
+ glob = strings.TrimSuffix(glob, "/")
if glob == "" {
continue
}
diff --git a/src/cmd/vendor/golang.org/x/mod/semver/semver.go b/src/cmd/vendor/golang.org/x/mod/semver/semver.go
index 7be398f80d..a30a22bf20 100644
--- a/src/cmd/vendor/golang.org/x/mod/semver/semver.go
+++ b/src/cmd/vendor/golang.org/x/mod/semver/semver.go
@@ -32,7 +32,6 @@ type parsed struct {
short string
prerelease string
build string
- err string
}
// IsValid reports whether v is a valid semantic version string.
@@ -172,12 +171,10 @@ func Sort(list []string) {
func parse(v string) (p parsed, ok bool) {
if v == "" || v[0] != 'v' {
- p.err = "missing v prefix"
return
}
p.major, v, ok = parseInt(v[1:])
if !ok {
- p.err = "bad major version"
return
}
if v == "" {
@@ -187,13 +184,11 @@ func parse(v string) (p parsed, ok bool) {
return
}
if v[0] != '.' {
- p.err = "bad minor prefix"
ok = false
return
}
p.minor, v, ok = parseInt(v[1:])
if !ok {
- p.err = "bad minor version"
return
}
if v == "" {
@@ -202,31 +197,26 @@ func parse(v string) (p parsed, ok bool) {
return
}
if v[0] != '.' {
- p.err = "bad patch prefix"
ok = false
return
}
p.patch, v, ok = parseInt(v[1:])
if !ok {
- p.err = "bad patch version"
return
}
if len(v) > 0 && v[0] == '-' {
p.prerelease, v, ok = parsePrerelease(v)
if !ok {
- p.err = "bad prerelease"
return
}
}
if len(v) > 0 && v[0] == '+' {
p.build, v, ok = parseBuild(v)
if !ok {
- p.err = "bad build"
return
}
}
if v != "" {
- p.err = "junk on end"
ok = false
return
}
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index 82e04c1d33..fd955a6932 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -28,7 +28,7 @@ golang.org/x/arch/x86/x86asm
## explicit; go 1.17
golang.org/x/crypto/ed25519
golang.org/x/crypto/ed25519/internal/edwards25519
-# golang.org/x/mod v0.6.0-dev.0.20210913215816-37dd6891021a
+# golang.org/x/mod v0.6.0-dev.0.20211102181907-3a5865c02020
## explicit; go 1.17
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile