From a423b1fff5a223bdb10bcaf3f9c796dca5a2ac5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 13 Jul 2020 13:18:30 +0200 Subject: [PATCH] Do not update go.mod during packaging and testing (#19823) (cherry picked from commit f91c96f672ba88edc668fe3d44249e46a3e9d2ec) --- dev-tools/mage/crossbuild.go | 1 + dev-tools/mage/fields.go | 2 ++ dev-tools/mage/integtest.go | 1 + 3 files changed, 4 insertions(+) diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index a553ee0e197..8bce2103fd9 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -263,6 +263,7 @@ func (b GolangCrossBuilder) Build() error { args = append(args, "--rm", + "--env", "GOFLAGS=-mod=readonly", "--env", "MAGEFILE_VERBOSE="+verbose, "--env", "MAGEFILE_TIMEOUT="+EnvOr("MAGEFILE_TIMEOUT", ""), "--env", fmt.Sprintf("SNAPSHOT=%v", Snapshot), diff --git a/dev-tools/mage/fields.go b/dev-tools/mage/fields.go index 94c3f899e9e..a4837315729 100644 --- a/dev-tools/mage/fields.go +++ b/dev-tools/mage/fields.go @@ -102,6 +102,7 @@ func generateFieldsYAML(baseDir, output string, moduleDirs ...string) error { } cmd := []string{"run", + "-mod=readonly", filepath.Join(beatsDir, globalFieldsCmdPath), "-es_beats_path", beatsDir, "-beat_path", baseDir, @@ -127,6 +128,7 @@ func GenerateFieldsGo(fieldsYML, out string) error { } cmd := []string{"run", + "-mod=readonly", filepath.Join(beatsDir, assetCmdPath), "-pkg", "include", "-in", fieldsYML, diff --git a/dev-tools/mage/integtest.go b/dev-tools/mage/integtest.go index e932a55c45d..94101c5056b 100644 --- a/dev-tools/mage/integtest.go +++ b/dev-tools/mage/integtest.go @@ -236,6 +236,7 @@ func initRunner(tester IntegrationTester, dir string, passInEnv map[string]strin // Create the custom env for the runner. env := map[string]string{ insideIntegrationTestEnvVar: "true", + "GOFLAGS": "-mod=vendor", } for name, value := range passInEnv { env[name] = value