diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 5362426aba2..6a11f7666cd 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