Skip to content

Commit f91c96f

Browse files
authored
Do not update go.mod during packaging and testing (#19823)
1 parent 9b7080f commit f91c96f

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

dev-tools/mage/crossbuild.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ func (b GolangCrossBuilder) Build() error {
263263

264264
args = append(args,
265265
"--rm",
266+
"--env", "GOFLAGS=-mod=readonly",
266267
"--env", "MAGEFILE_VERBOSE="+verbose,
267268
"--env", "MAGEFILE_TIMEOUT="+EnvOr("MAGEFILE_TIMEOUT", ""),
268269
"--env", fmt.Sprintf("SNAPSHOT=%v", Snapshot),

dev-tools/mage/fields.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func generateFieldsYAML(baseDir, output string, moduleDirs ...string) error {
102102
}
103103

104104
cmd := []string{"run",
105+
"-mod=readonly",
105106
filepath.Join(beatsDir, globalFieldsCmdPath),
106107
"-es_beats_path", beatsDir,
107108
"-beat_path", baseDir,
@@ -127,6 +128,7 @@ func GenerateFieldsGo(fieldsYML, out string) error {
127128
}
128129

129130
cmd := []string{"run",
131+
"-mod=readonly",
130132
filepath.Join(beatsDir, assetCmdPath),
131133
"-pkg", "include",
132134
"-in", fieldsYML,

dev-tools/mage/integtest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func initRunner(tester IntegrationTester, dir string, passInEnv map[string]strin
236236
// Create the custom env for the runner.
237237
env := map[string]string{
238238
insideIntegrationTestEnvVar: "true",
239+
"GOFLAGS": "-mod=vendor",
239240
}
240241
for name, value := range passInEnv {
241242
env[name] = value

0 commit comments

Comments
 (0)