Lines Matching refs:err
34 func report(err error) {
35 fmt.Fprintln(os.Stderr, err)
51 f, err := os.Open(filename)
52 if err != nil {
53 return err
61 src, err := ioutil.ReadAll(in)
62 if err != nil {
63 return err
70 for _, err := range errs {
71 fmt.Fprintln(os.Stderr, err)
80 res, err := parser.Print(file)
81 if err != nil {
82 return err
91 err = ioutil.WriteFile(filename, res, 0644)
92 if err != nil {
93 return err
97 data, err := diff(src, res)
98 if err != nil {
99 return fmt.Errorf("computing diff: %s", err)
107 _, err = out.Write(res)
110 return err
114 visitFile := func(path string, f os.FileInfo, err error) error {
115 if err == nil && f.Name() == "Blueprints" {
116 err = processFile(path, os.Stdout)
118 if err != nil {
119 report(err)
141 if err := processReader("<standard input>", os.Stdin, os.Stdout); err != nil {
142 report(err)
149 switch dir, err := os.Stat(path); {
150 case err != nil:
151 report(err)
155 if err := processFile(path, os.Stdout); err != nil {
156 report(err)
164 func diff(b1, b2 []byte) (data []byte, err error) {
165 f1, err := ioutil.TempFile("", "bpfmt")
166 if err != nil {
172 f2, err := ioutil.TempFile("", "bpfmt")
173 if err != nil {
182 data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput()
186 err = nil