code: func handleBuildbotBuild(c *router.Context) error {
  	buildNum, err := strconv.Atoi(c.Params.ByName("number"))
  	if err != nil {
  		return errors.Annotate(err, "build number is not a number").
  			Tag(grpcutil.InvalidArgumentTag).
  			Err()
  	}
  	id := buildbotapi.BuildID{
  		Master:  c.Params.ByName("master"),
  		Builder: c.Params.ByName("builder"),
  		Number:  buildNum,
  	}
  	if err := id.Validate(); err != nil {
  		return err
  	}
  
  	// If this build is emulated, redirect to LUCI.
  	b, err := buildstore.EmulationOf(c.Context, id)
  	switch {
  	case err != nil:
  		return err
  	case b != nil && b.Number != nil:
  		u := *c.Request.URL
  		u.Path = fmt.Sprintf("/p/%s/builders/%s/%s/%d", b.Project, b.Bucket, b.Builder, *b.Number)
  		http.Redirect(c.Writer, c.Request, u.String(), http.StatusFound)
  		return nil
  	default:
  		build, err := buildbot.GetBuild(c.Context, id)
  		return renderBuildLegacy(c, build, false, err)
  	}
  }
docs: // handleBuildbotBuild renders a buildbot build.
  // Requires emulationMiddleware.