Lines Matching refs:err
74 if version, err := ioutil.ReadFile(filepath.Join(runtime.GOROOT(), "VERSION")); err == nil {
79 if version, err := cmd.Output(); err == nil {
82 panic(fmt.Sprintf("Unable to discover go version: %v", err))
195 err := p.findDeps(config, path, depSet)
196 if err != nil {
197 return err
265 foundPkgs, err := parser.ParseDir(token.NewFileSet(), path, func(fi os.FileInfo) bool {
278 if err != nil {
279 return fmt.Errorf("Error parsing directory %q: %v", path, err)
311 name, err := strconv.Unquote(importSpec.Path.Value)
312 if err != nil {
313 return fmt.Errorf("%s: invalid quoted string: <%s> %v", filename, importSpec.Path.Value, err)
327 if path, ok, err := config.Path(name); err != nil {
328 return err
345 if err := pkg.findDeps(config, pkgPath, allPackages); err != nil {
346 return err
423 f, err := os.Open(filename)
424 if err != nil {
426 err = fmt.Errorf("%s: %v", filename, err)
427 p.failed = err
428 return err
430 _, err = io.Copy(hash, f)
431 if err != nil {
433 err = fmt.Errorf("%s: %v", filename, err)
434 p.failed = err
435 return err
442 if _, err := os.Stat(p.output); err != nil {
446 if oldSha, err := ioutil.ReadFile(shaFile); err == nil {
459 err := os.RemoveAll(p.pkgDir)
460 if err != nil {
461 err = fmt.Errorf("%s: %v", p.Name, err)
462 p.failed = err
463 return err
466 err = os.MkdirAll(filepath.Dir(p.output), 0777)
467 if err != nil {
468 err = fmt.Errorf("%s: %v", p.Name, err)
469 p.failed = err
470 return err
479 err = cmd.Run()
480 if err != nil {
482 err = fmt.Errorf("%q: %v", commandText, err)
483 p.failed = err
484 return err
487 err = ioutil.WriteFile(shaFile, p.hashResult, 0666)
488 if err != nil {
489 err = fmt.Errorf("%s: %v", p.Name, err)
490 p.failed = err
491 return err
508 if _, err := os.Stat(out); err != nil {
510 } else if oldSha, err := ioutil.ReadFile(shaFile); err != nil {
522 err := os.Remove(shaFile)
523 if err != nil && !os.IsNotExist(err) {
524 return err
526 err = os.Remove(out)
527 if err != nil && !os.IsNotExist(err) {
528 return err
545 err = cmd.Run()
546 if err != nil {
547 return fmt.Errorf("command %s failed with error %v", cmd.Args, err)
559 lockFile, err := os.OpenFile(lockFileName, os.O_RDWR|os.O_CREATE, 0666)
560 if err != nil {
561 return nil, fmt.Errorf("Error creating lock file (%q): %v", lockFileName, err)
565 err = syscall.Flock(int(lockFile.Fd()), syscall.LOCK_EX)
566 if err != nil {
567 return nil, fmt.Errorf("Error locking file (%q): %v", lockFileName, err)
570 path, ok, err := config.Path(pkg)
571 if err != nil {
572 return nil, fmt.Errorf("Error finding package %q for main: %v", pkg, err)
579 if err := os.MkdirAll(intermediates, 0777); err != nil {
580 return nil, fmt.Errorf("Failed to create intermediates directory: %v", err)
583 if err := p.FindDeps(config, path); err != nil {
584 return nil, fmt.Errorf("Failed to find deps of %v: %v", pkg, err)
586 if err := p.Compile(config, intermediates); err != nil {
587 return nil, fmt.Errorf("Failed to compile %v: %v", pkg, err)
589 if err := p.Link(config, out); err != nil {
590 return nil, fmt.Errorf("Failed to link %v: %v", pkg, err)
599 if pkg, err := Build(config, mybin, "github.com/google/blueprint/microfactory/main"); err != nil {
600 fmt.Fprintln(os.Stderr, err)
610 if err := cmd.Run(); err == nil {
612 } else if e, ok := err.(*exec.ExitError); ok {
633 err := flags.Parse(os.Args[1:])
635 if err == flag.ErrHelp || flags.NArg() != 1 || output == "" {
642 if traceFile, err := os.OpenFile(tracePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666); err == nil {
651 if executable, err := os.Executable(); err == nil {
663 if _, err := Build(&config, output, flags.Arg(0)); err != nil {
664 fmt.Fprintln(os.Stderr, err)