func ReadAFile(fileName string) *dm.File { file, err := dm.ReadFile(fileName) if err != nil { FailWithMessage(false, "Failed to read file %s: %s", fileName, err) } return file }
func (p *cmdInputs) AddInputFile(fileName string) { if fileName == "-" { if p.readingStdin { FailWithMessage(false, "Only one input file maybe '-' (for standard input).") } p.readingStdin = true } file, err := dm.ReadFile(fileName) if err != nil { FailWithMessage(false, "Failed to read file %s: %s", fileName, err) os.Exit(int(AnError) & 0xff) } p.fileNames = append(p.fileNames, fileName) p.files = append(p.files, file) if p.perm == 0 && fileName != "-" { fi, err := os.Stat(fileName) if err == nil { p.perm = fi.Mode().Perm() } } }