You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Deps contains targets related to checking dependencies
214
212
typeDeps mg.Namespace
215
213
216
-
// CheckNoBeats is required to make sure we are not introducing
217
-
// dependency on elastic/beats.
218
-
func (Deps) CheckNoBeats() error {
219
-
goModPath, err:=filepath.Abs("go.mod")
220
-
iferr!=nil {
221
-
returnerr
222
-
}
223
-
goModFile, err:=os.Open(goModPath)
224
-
iferr!=nil {
225
-
returnfmt.Errorf("failed to open module file: %w", err)
226
-
}
227
-
beatsImport:= []byte("github.com/elastic/beats")
228
-
scanner:=bufio.NewScanner(goModFile)
229
-
lineCount:=1
230
-
forscanner.Scan() {
231
-
line:=scanner.Bytes()
232
-
ifbytes.Contains(line, beatsImport) {
233
-
returnfmt.Errorf("line %d is a beats dependency: '%s'\nPlease, make sure you are not adding anything that depends on %s", lineCount, line, beatsImport)
234
-
}
235
-
lineCount++
236
-
}
237
-
iferr:=scanner.Err(); err!=nil {
238
-
returnerr
239
-
}
240
-
returnnil
241
-
}
242
-
243
214
// CheckModuleTidy checks if `go mod tidy` was run before the last commit.
0 commit comments