mirror of
https://github.com/golang/go
synced 2024-11-23 22:30:05 -07:00
cmd/go/internal/modfetch: stop cutting the last character of versions
When a zip archive for a module contains an unexpected file, the error
message removes the last character in the version number, e.g. an invalid
archive for "somemod@v1.2.3" would generate the following error:
"zip for somemod@1.2. has unexpected file..."
Change-Id: I366622df16a71fa7467a4bc62cb696e3e83a2942
GitHub-Last-Rev: f172283bcd
GitHub-Pull-Request: golang/go#27279
Reviewed-on: https://go-review.googlesource.com/131635
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
8dbd9afbb0
commit
56dc1795e7
@ -123,7 +123,7 @@ func downloadZip(mod module.Version, target string) error {
|
|||||||
for _, f := range z.File {
|
for _, f := range z.File {
|
||||||
if !strings.HasPrefix(f.Name, prefix) {
|
if !strings.HasPrefix(f.Name, prefix) {
|
||||||
z.Close()
|
z.Close()
|
||||||
return fmt.Errorf("zip for %s has unexpected file %s", prefix[:len(prefix)-1], f.Name)
|
return fmt.Errorf("zip for %s has unexpected file %s", prefix, f.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z.Close()
|
z.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user