We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e3e754 commit f133029Copy full SHA for f133029
1 file changed
main.go
@@ -4,6 +4,7 @@ import (
4
"context"
5
"log"
6
"log/slog"
7
+ "os"
8
"os/exec"
9
"strings"
10
"sync"
@@ -33,6 +34,12 @@ var cli struct {
33
34
35
// GOCACHE returns the Go build cache directory.
36
var GOCACHE = sync.OnceValue(func() string {
37
+ // in theory, someone might not have go in the PATH
38
+ if v := os.Getenv("GOCACHE"); v != "" {
39
+ return v
40
+ }
41
+
42
+ // that handles `go env -w` and the default value
43
b, err := exec.Command("go", "env", "GOCACHE").Output()
44
if err != nil {
45
panic(err)
0 commit comments