From 0684661728c0e2abb4f43611ea532d3aa4890c95 Mon Sep 17 00:00:00 2001 From: Max Neverov Date: Thu, 21 Nov 2024 07:34:59 +0100 Subject: [PATCH] Add errcheck when initializing default cache. --- src/cmd/go/internal/cache/default.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/cache/default.go b/src/cmd/go/internal/cache/default.go index 0f083fb4eaf..887acd60aec 100644 --- a/src/cmd/go/internal/cache/default.go +++ b/src/cmd/go/internal/cache/default.go @@ -35,7 +35,10 @@ See golang.org to learn more about Go. // initDefaultCache does the work of finding the default cache // the first time Default is called. func initDefaultCache() Cache { - dir, _, _ := DefaultDir() + dir, _, err := DefaultDir() + if err != nil { + base.Fatalf("build cache is required, but could not be located: %v", err) + } if dir == "off" { if defaultDirErr != nil { base.Fatalf("build cache is required, but could not be located: %v", defaultDirErr)