MCPcopy
hub / github.com/istio/istio / writeFile

Function writeFile

tools/bug-report/pkg/bugreport/bugreport.go:571–585  ·  view source on GitHub ↗
(path, text string, dryRun bool)

Source from the content-addressed store, hash-verified

569}
570
571func writeFile(path, text string, dryRun bool) {
572 if dryRun {
573 return
574 }
575 if strings.TrimSpace(text) == "" {
576 return
577 }
578 mkdirOrExit(path)
579
580 defer logRuntime(time.Now(), "Done writing file for path %v", path)
581
582 if err := os.WriteFile(path, []byte(text), 0o644); err != nil {
583 log.Errorf(err.Error())
584 }
585}
586
587func mkdirOrExit(fpath string) {
588 if err := os.MkdirAll(path.Dir(fpath), 0o755); err != nil {

Callers 6

runBugReportCommandFunction · 0.70
dumpRevisionsAndVersionsFunction · 0.70
getIstiodLogsFunction · 0.70
getOperatorLogsFunction · 0.70
getCniLogsFunction · 0.70
writeFilesFunction · 0.70

Calls 5

ErrorfFunction · 0.92
mkdirOrExitFunction · 0.85
logRuntimeFunction · 0.85
NowMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…