From: Roberto Selbach Date: Mon, 27 Aug 2018 15:57:32 +0000 (+0000) Subject: cmd/go/internal/modfetch: stop cutting the last character of versions X-Git-Tag: go1.12beta1~1093 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=56dc1795e756767adb373a5bc151c9c820152025;p=gostls13.git 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: f172283bcdffd45b485b1e8fd99795eb93fef726 GitHub-Pull-Request: golang/go#27279 Reviewed-on: https://go-review.googlesource.com/131635 Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills --- diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go index 2e26bac434..8485932b42 100644 --- a/src/cmd/go/internal/modfetch/fetch.go +++ b/src/cmd/go/internal/modfetch/fetch.go @@ -123,7 +123,7 @@ func downloadZip(mod module.Version, target string) error { for _, f := range z.File { if !strings.HasPrefix(f.Name, prefix) { 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()