Lines Matching refs:err
32 func report(err error) {
33 fmt.Fprintln(os.Stderr, err)
46 f, err := os.Open(filename)
47 if err != nil {
48 return err
54 src, err := ioutil.ReadAll(in)
55 if err != nil {
56 return err
63 for _, err := range errs {
64 fmt.Fprintln(os.Stderr, err)
73 res, err := parser.Print(file)
74 if err != nil {
75 return err
84 err = ioutil.WriteFile(filename, res, 0644)
85 if err != nil {
86 return err
90 data, err := diff(src, res)
91 if err != nil {
92 return fmt.Errorf("computing diff: %s", err)
100 _, err = out.Write(res)
103 return err
106 func visitFile(path string, f os.FileInfo, err error) error {
107 if err == nil && f.Name() == "Blueprints" {
108 err = processFile(path, nil, os.Stdout)
110 if err != nil {
111 report(err)
129 if err := processFile("<standard input>", os.Stdin, os.Stdout); err != nil {
130 report(err)
137 switch dir, err := os.Stat(path); {
138 case err != nil:
139 report(err)
143 if err := processFile(path, nil, os.Stdout); err != nil {
144 report(err)
150 func diff(b1, b2 []byte) (data []byte, err error) {
151 f1, err := ioutil.TempFile("", "bpfmt")
152 if err != nil {
158 f2, err := ioutil.TempFile("", "bpfmt")
159 if err != nil {
168 data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput()
172 err = nil