From 121e47fb41f521446e9b3babe5b7685cbe557e9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:10:57 +0000 Subject: [PATCH 1/3] build(deps): bump github.com/ldez/gomoddirectives from 0.6.0 to 0.6.1 Bumps [github.com/ldez/gomoddirectives](https://github.com/ldez/gomoddirectives) from 0.6.0 to 0.6.1. - [Commits](https://github.com/ldez/gomoddirectives/compare/v0.6.0...v0.6.1) --- updated-dependencies: - dependency-name: github.com/ldez/gomoddirectives dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 5b7e67765faf..6ae6d433ccd4 100644 --- a/go.mod +++ b/go.mod @@ -66,8 +66,8 @@ require ( github.com/kyoh86/exportloopref v0.1.11 github.com/lasiar/canonicalheader v1.1.2 github.com/ldez/exptostd v0.3.1 - github.com/ldez/gomoddirectives v0.6.0 - github.com/ldez/grignotin v0.8.0 + github.com/ldez/gomoddirectives v0.6.1 + github.com/ldez/grignotin v0.9.0 github.com/ldez/tagliatelle v0.7.1 github.com/ldez/usetesting v0.4.2 github.com/leonklingele/grouper v1.1.2 diff --git a/go.sum b/go.sum index 4b6e02ad4f52..db8027a40b68 100644 --- a/go.sum +++ b/go.sum @@ -290,7 +290,6 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.5.0 h1:Dq4wT1DdTwTGCQQv3rl3IvD5Ld0E6HiY+3Zh0sUGqw8= -github.com/gostaticanalysis/testutil v0.5.0/go.mod h1:OLQSbuM6zw2EvCcXTz1lVq5unyoNft372msDY0nY5Hs= github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo= github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= @@ -353,10 +352,10 @@ github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0 github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= github.com/ldez/exptostd v0.3.1 h1:90yWWoAKMFHeovTK8uzBms9Ppp8Du/xQ20DRO26Ymrw= github.com/ldez/exptostd v0.3.1/go.mod h1:iZBRYaUmcW5jwCR3KROEZ1KivQQp6PHXbDPk9hqJKCQ= -github.com/ldez/gomoddirectives v0.6.0 h1:Jyf1ZdTeiIB4dd+2n4qw+g4aI9IJ6JyfOZ8BityWvnA= -github.com/ldez/gomoddirectives v0.6.0/go.mod h1:TuwOGYoPAoENDWQpe8DMqEm5nIfjrxZXmxX/CExWyZ4= -github.com/ldez/grignotin v0.8.0 h1:M9QeBN2qyPrqwqx+RhG7W2xKjyV7dRWKjNghbz7fkM0= -github.com/ldez/grignotin v0.8.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= +github.com/ldez/gomoddirectives v0.6.1 h1:Z+PxGAY+217f/bSGjNZr/b2KTXcyYLgiWI6geMBN2Qc= +github.com/ldez/gomoddirectives v0.6.1/go.mod h1:cVBiu3AHR9V31em9u2kwfMKD43ayN5/XDgr+cdaFaKs= +github.com/ldez/grignotin v0.9.0 h1:MgOEmjZIVNn6p5wPaGp/0OKWyvq42KnzAt/DAb8O4Ow= +github.com/ldez/grignotin v0.9.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk= github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I= github.com/ldez/usetesting v0.4.2 h1:J2WwbrFGk3wx4cZwSMiCQQ00kjGR0+tuuyW0Lqm4lwA= @@ -416,8 +415,6 @@ github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cT github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= -github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= @@ -546,9 +543,7 @@ github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tdakkota/asciicheck v0.3.0 h1:LqDGgZdholxZMaJgpM6b0U9CFIjDCbFdUF00bDnBKOQ= github.com/tdakkota/asciicheck v0.3.0/go.mod h1:KoJKXuX/Z/lt6XzLo8WMBfQGzak0SrAKZlvRr4tg8Ac= -github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= -github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.20 h1:z/p8Ek55UdNvzt4TFn2zx2KscpW4rWqcnUrdmvWJj7E= github.com/tetafro/godot v1.4.20/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= From 2b793994713e8a389a59003686ae5b03d630aaeb Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 16 Jan 2025 19:11:44 +0100 Subject: [PATCH 2/3] chore: fix go.sum --- go.sum | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go.sum b/go.sum index db8027a40b68..ea1e8d950a6b 100644 --- a/go.sum +++ b/go.sum @@ -290,6 +290,7 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.5.0 h1:Dq4wT1DdTwTGCQQv3rl3IvD5Ld0E6HiY+3Zh0sUGqw8= +github.com/gostaticanalysis/testutil v0.5.0/go.mod h1:OLQSbuM6zw2EvCcXTz1lVq5unyoNft372msDY0nY5Hs= github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo= github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= @@ -415,6 +416,8 @@ github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cT github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= +github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= @@ -543,7 +546,9 @@ github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tdakkota/asciicheck v0.3.0 h1:LqDGgZdholxZMaJgpM6b0U9CFIjDCbFdUF00bDnBKOQ= github.com/tdakkota/asciicheck v0.3.0/go.mod h1:KoJKXuX/Z/lt6XzLo8WMBfQGzak0SrAKZlvRr4tg8Ac= +github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= +github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.20 h1:z/p8Ek55UdNvzt4TFn2zx2KscpW4rWqcnUrdmvWJj7E= github.com/tetafro/godot v1.4.20/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= From fb86e3eeae2cd6cefe80a6f96e74dfe967dfcc47 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 16 Jan 2025 19:12:59 +0100 Subject: [PATCH 3/3] chore: update goenv implementation --- pkg/config/config.go | 15 ++++++------ pkg/config/loader.go | 3 ++- pkg/goformatters/gci/gci.go | 3 ++- pkg/goutil/env.go | 34 ++++++++------------------ pkg/lint/package.go | 6 +++-- pkg/logutils/logutils.go | 47 +++++++++++++++++++++--------------- pkg/result/processors/cgo.go | 6 +++-- 7 files changed, 58 insertions(+), 56 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index c846611838a1..339007b62fd3 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -2,6 +2,7 @@ package config import ( "cmp" + "context" "fmt" "os" "path/filepath" @@ -80,8 +81,8 @@ func IsGoGreaterThanOrEqual(current, limit string) bool { return v1.GreaterThanOrEqual(l) } -func detectGoVersion() string { - return cmp.Or(detectGoVersionFromGoMod(), "1.17") +func detectGoVersion(ctx context.Context) string { + return cmp.Or(detectGoVersionFromGoMod(ctx), "1.17") } // detectGoVersionFromGoMod tries to get Go version from go.mod. @@ -89,11 +90,11 @@ func detectGoVersion() string { // else it returns `go` version if present, // else it returns `GOVERSION` version if present, // else it returns empty. -func detectGoVersionFromGoMod() string { - values, err := goenv.Get(goenv.GOMOD, goenv.GOVERSION) +func detectGoVersionFromGoMod(ctx context.Context) string { + values, err := goenv.Get(ctx, goenv.GOMOD, goenv.GOVERSION) if err != nil { values = map[string]string{ - goenv.GOMOD: detectGoModFallback(), + goenv.GOMOD: detectGoModFallback(ctx), } } @@ -143,8 +144,8 @@ func parseGoMod(goMod string) (*modfile.File, error) { return modfile.Parse("go.mod", raw, nil) } -func detectGoModFallback() string { - info, err := gomod.GetModuleInfo() +func detectGoModFallback(ctx context.Context) string { + info, err := gomod.GetModuleInfo(ctx) if err != nil { return "" } diff --git a/pkg/config/loader.go b/pkg/config/loader.go index 56f57d9d5dd7..3d1f76d12576 100644 --- a/pkg/config/loader.go +++ b/pkg/config/loader.go @@ -2,6 +2,7 @@ package config import ( "cmp" + "context" "errors" "fmt" "os" @@ -286,7 +287,7 @@ func (l *Loader) appendStringSlice(name string, current *[]string) { func (l *Loader) handleGoVersion() { if l.cfg.Run.Go == "" { - l.cfg.Run.Go = detectGoVersion() + l.cfg.Run.Go = detectGoVersion(context.Background()) } l.cfg.LintersSettings.Govet.Go = l.cfg.Run.Go diff --git a/pkg/goformatters/gci/gci.go b/pkg/goformatters/gci/gci.go index 590f8da2a0e6..f872c3c667f6 100644 --- a/pkg/goformatters/gci/gci.go +++ b/pkg/goformatters/gci/gci.go @@ -1,6 +1,7 @@ package gci import ( + "context" "fmt" gcicfg "github.com/daixiang0/gci/pkg/config" @@ -22,7 +23,7 @@ func New(settings *config.GciSettings) (*Formatter, error) { log.InitLogger() _ = log.L().Sync() - modPath, err := gomod.GetModulePath() + modPath, err := gomod.GetModulePath(context.Background()) if err != nil { internal.FormatterLogger.Errorf("gci: %v", err) } diff --git a/pkg/goutil/env.go b/pkg/goutil/env.go index 7b748d8e9031..beb71f722e0a 100644 --- a/pkg/goutil/env.go +++ b/pkg/goutil/env.go @@ -2,53 +2,39 @@ package goutil import ( "context" - "encoding/json" "fmt" "os" - "os/exec" - "strings" "time" + "github.com/ldez/grignotin/goenv" + "github.com/golangci/golangci-lint/pkg/logutils" ) type EnvKey string -const ( - EnvGoCache EnvKey = "GOCACHE" - EnvGoRoot EnvKey = "GOROOT" -) - type Env struct { - vars map[string]string - log logutils.Log - debugf logutils.DebugFunc + vars map[string]string + log logutils.Log } func NewEnv(log logutils.Log) *Env { return &Env{ - vars: map[string]string{}, - log: log, - debugf: logutils.Debug(logutils.DebugKeyEnv), + vars: map[string]string{}, + log: log, } } func (e Env) Discover(ctx context.Context) error { startedAt := time.Now() - //nolint:gosec // Everything is static here. - cmd := exec.CommandContext(ctx, "go", "env", "-json", string(EnvGoCache), string(EnvGoRoot)) - - out, err := cmd.Output() + var err error + e.vars, err = goenv.Get(ctx, goenv.GOCACHE, goenv.GOROOT) if err != nil { - return fmt.Errorf("failed to run '%s': %w", strings.Join(cmd.Args, " "), err) - } - - if err = json.Unmarshal(out, &e.vars); err != nil { - return fmt.Errorf("failed to parse '%s' json: %w", strings.Join(cmd.Args, " "), err) + return fmt.Errorf("%w", err) } - e.debugf("Read go env for %s: %#v", time.Since(startedAt), e.vars) + e.log.Infof("Read go env for %s: %#v", time.Since(startedAt), e.vars) return nil } diff --git a/pkg/lint/package.go b/pkg/lint/package.go index c314166cae37..736498b0b4d4 100644 --- a/pkg/lint/package.go +++ b/pkg/lint/package.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "github.com/ldez/grignotin/goenv" "golang.org/x/tools/go/packages" "github.com/golangci/golangci-lint/pkg/config" @@ -204,12 +205,13 @@ func (l *PackageLoader) debugPrintLoadedPackages(pkgs []*packages.Package) { func (l *PackageLoader) prepareBuildContext() { // Set GOROOT to have working cross-compilation: cross-compiled binaries // have invalid GOROOT. XXX: can't use runtime.GOROOT(). - goroot := l.goenv.Get(goutil.EnvGoRoot) + goroot := l.goenv.Get(goenv.GOROOT) if goroot == "" { return } - os.Setenv(string(goutil.EnvGoRoot), goroot) + _ = os.Setenv(goenv.GOROOT, goroot) + build.Default.GOROOT = goroot build.Default.BuildTags = l.cfg.Run.BuildTags } diff --git a/pkg/logutils/logutils.go b/pkg/logutils/logutils.go index 9ae402047f55..b5d465de59f2 100644 --- a/pkg/logutils/logutils.go +++ b/pkg/logutils/logutils.go @@ -15,39 +15,47 @@ const EnvTestRun = "GL_TEST_RUN" // - Some analysis details: `GL_DEBUG=goanalysis/analyze,goanalysis/facts golangci-lint run` const envDebug = "GL_DEBUG" +const ( + DebugKeyBinSalt = "bin_salt" + DebugKeyConfigReader = "config_reader" + DebugKeyEmpty = "" + DebugKeyEnabledLinters = "enabled_linters" + DebugKeyExec = "exec" + DebugKeyFormatter = "formatter" + DebugKeyGoEnv = "goenv" + DebugKeyLinter = "linter" + DebugKeyLintersContext = "linters_context" + DebugKeyLintersDB = "lintersdb" + DebugKeyLintersOutput = "linters_output" + DebugKeyLoader = "loader" // Debugs packages loading (including `go/packages` internal debugging). + DebugKeyPkgCache = "pkgcache" + DebugKeyRunner = "runner" + DebugKeyStopwatch = "stopwatch" + DebugKeyTest = "test" +) + +// Printers. +const ( + DebugKeyTabPrinter = "tab_printer" + DebugKeyTextPrinter = "text_printer" +) + +// Processors. const ( DebugKeyAutogenExclude = "autogen_exclude" // Debugs a filter excluding autogenerated source code. - DebugKeyBinSalt = "bin_salt" - DebugKeyConfigReader = "config_reader" - DebugKeyEmpty = "" - DebugKeyEnabledLinters = "enabled_linters" - DebugKeyEnv = "env" // Debugs `go env` command. DebugKeyExcludeRules = "exclude_rules" - DebugKeyExec = "exec" DebugKeyFilenameUnadjuster = "filename_unadjuster" - DebugKeyFormatter = "formatter" - DebugKeyGoEnv = "goenv" DebugKeyInvalidIssue = "invalid_issue" - DebugKeyLinter = "linter" - DebugKeyLintersContext = "linters_context" - DebugKeyLintersDB = "lintersdb" - DebugKeyLintersOutput = "linters_output" - DebugKeyLoader = "loader" // Debugs packages loading (including `go/packages` internal debugging). DebugKeyMaxFromLinter = "max_from_linter" DebugKeyMaxSameIssues = "max_same_issues" DebugKeyPathAbsoluter = "path_absoluter" DebugKeyPathPrettifier = "path_prettifier" - DebugKeyPkgCache = "pkgcache" - DebugKeyRunner = "runner" DebugKeySeverityRules = "severity_rules" DebugKeySkipDirs = "skip_dirs" DebugKeySourceCode = "source_code" - DebugKeyStopwatch = "stopwatch" - DebugKeyTabPrinter = "tab_printer" - DebugKeyTest = "test" - DebugKeyTextPrinter = "text_printer" ) +// Analysis. const ( DebugKeyGoAnalysis = "goanalysis" @@ -61,6 +69,7 @@ const ( DebugKeyGoAnalysisFactsInherit = DebugKeyGoAnalysisFacts + "/inherit" ) +// Linters. const ( DebugKeyForbidigo = "forbidigo" // Debugs `forbidigo` linter. DebugKeyGoCritic = "gocritic" // Debugs `gocritic` linter. diff --git a/pkg/result/processors/cgo.go b/pkg/result/processors/cgo.go index 34dc8a7cfb92..b09b8b72837a 100644 --- a/pkg/result/processors/cgo.go +++ b/pkg/result/processors/cgo.go @@ -4,6 +4,8 @@ import ( "path/filepath" "strings" + "github.com/ldez/grignotin/goenv" + "github.com/golangci/golangci-lint/pkg/goutil" "github.com/golangci/golangci-lint/pkg/result" ) @@ -19,9 +21,9 @@ type Cgo struct { goCacheDir string } -func NewCgo(goenv *goutil.Env) *Cgo { +func NewCgo(env *goutil.Env) *Cgo { return &Cgo{ - goCacheDir: goenv.Get(goutil.EnvGoCache), + goCacheDir: env.Get(goenv.GOCACHE), } }