]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modfetch: reduce path redundancy in checkMod error reporting
authorBryan C. Mills <bcmills@google.com>
Fri, 9 Aug 2019 21:35:19 +0000 (17:35 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 12 Sep 2019 14:08:25 +0000 (14:08 +0000)
Updates #30748

Change-Id: I38a6cdc9c9b488fec579e6362a4284e26e0f526e
Reviewed-on: https://go-review.googlesource.com/c/go/+/189782
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modfetch/fetch.go

index 51a56028c4acbeab3d3c8b2130916b408a3e6921..2eead5f74652e7e847a57f622f63ac6a1cfe55a5 100644 (file)
@@ -7,6 +7,7 @@ package modfetch
 import (
        "archive/zip"
        "bytes"
+       "errors"
        "fmt"
        "io"
        "io/ioutil"
@@ -361,19 +362,19 @@ func checkMod(mod module.Version) {
        // Do the file I/O before acquiring the go.sum lock.
        ziphash, err := CachePath(mod, "ziphash")
        if err != nil {
-               base.Fatalf("verifying %s@%s: %v", mod.Path, mod.Version, err)
+               base.Fatalf("verifying %v", module.VersionError(mod, err))
        }
        data, err := renameio.ReadFile(ziphash)
        if err != nil {
-               if os.IsNotExist(err) {
+               if errors.Is(err, os.ErrNotExist) {
                        // This can happen if someone does rm -rf GOPATH/src/cache/download. So it goes.
                        return
                }
-               base.Fatalf("verifying %s@%s: %v", mod.Path, mod.Version, err)
+               base.Fatalf("verifying %v", module.VersionError(mod, err))
        }
        h := strings.TrimSpace(string(data))
        if !strings.HasPrefix(h, "h1:") {
-               base.Fatalf("verifying %s@%s: unexpected ziphash: %q", mod.Path, mod.Version, h)
+               base.Fatalf("verifying %v", module.VersionError(mod, fmt.Errorf("unexpected ziphash: %q", h)))
        }
 
        checkModSum(mod, h)