code: func (*Builder) Build(ctx *context.Context, build config.Build, options api.Options) error {
  	if err := checkMain(build); err != nil {
  		return err
  	}
  	target, err := newBuildTarget(options.Target)
  	if err != nil {
  		return err
  	}
  
  	var cmd = []string{"go", "build"}
  
  	var env = append(ctx.Env.Strings(), build.Env...)
  	env = append(env, target.Env()...)
  
  	flags, err := processFlags(ctx, env, build.Flags, "")
  	if err != nil {
  		return err
  	}
  	cmd = append(cmd, flags...)
  
  	asmflags, err := processFlags(ctx, env, build.Asmflags, "-asmflags=")
  	if err != nil {
  		return err
  	}
  	cmd = append(cmd, asmflags...)
  
  	gcflags, err := processFlags(ctx, env, build.Gcflags, "-gcflags=")
  	if err != nil {
  		return err
  	}
  	cmd = append(cmd, gcflags...)
  
  	ldflags, err := processFlags(ctx, env, build.Ldflags, "-ldflags=")
  	if err != nil {
  		return err
  	}
  	cmd = append(cmd, ldflags...)
  
  	cmd = append(cmd, "-o", options.Path, build.Main)
  	if err := run(ctx, cmd, env); err != nil {
  		return errors.Wrapf(err, "failed to build for %s", options.Target)
  	}
  	ctx.Artifacts.Add(artifact.Artifact{
  		Type:   artifact.Binary,
  		Path:   options.Path,
  		Name:   options.Name,
  		Goos:   target.os,
  		Goarch: target.arch,
  		Goarm:  target.arm,
  		Extra: map[string]interface{}{
  			"Binary": build.Binary,
  			"Ext":    options.Ext,
  			"ID":     build.ID,
  		},
  	})
  	return nil
  }
docs: // Build builds a golang build