code: func Generate(pkg *PackageInfo, importDirs []string, protocCommand string, protocFlags []string, printOnly bool) (err error) {
  	args := protocFlags[0:len(protocFlags):len(protocFlags)]
  
  	files := make([]string, 0, len(pkg.Files))
  	for _, f := range pkg.Files {
  		files = append(files, f.FullPath)
  	}
  	sort.Strings(files)
  	args = append(args, files...)
  
  	if printOnly {
  		fmt.Printf("%s %s\n", protocCommand, strings.Join(args, " "))
  		return nil
  	}
  	cmd := exec.Command(protocCommand, args...)
  	out, err := cmd.CombinedOutput()
  	if err != nil {
  		cmdline := fmt.Sprintf("%s %s\n", protocCommand, strings.Join(args, " "))
  		return fmt.Errorf("error running %v\n%v\nOutput:\n======\n%s======\n", cmdline, err, out)
  	}
  	return nil
  }
docs: // Generate does the actual generation of protos.