code: func generateFile(scripts []*script, tmplFile string, dest string) error {
  	// Treat the contents of the script file as a template and execute
  	// it with scriptsContext (a map of constant keys) as the data.
  	buf := bytes.NewBuffer([]byte{})
  	for _, script := range scripts {
  		scriptTmpl, err := template.New("script").Parse(script.RawSrc)
  		if err != nil {
  			return err
  		}
  		buf.Reset()
  		if err := scriptTmpl.Execute(buf, scriptContext); err != nil {
  			return err
  		}
  		script.Src = buf.String()
  	}
  	// Now generate the go source code by executing genTmpl. The generated
  	// code uses the Src property of the scripts as the argument to redis.NewScript.
  	genTmpl, err := template.ParseFiles(tmplFile)
  	if err != nil {
  		return err
  	}
  	destFile, err := os.Create(dest)
  	if err != nil {
  		return err
  	}
  	return genTmpl.Execute(destFile, scripts)
  }
docs: // generateFile generates go source code and writes to
  // the source file located at dest (creating it if needed).
  // It executes the template located at tmplFile with scripts
  // as the context.