func (t *templateData) dump() error {
	if len(t.Accessors) == 0 {
		logf("No accessors for %v; skipping.", t.Filename)
		return nil
	}

	// Sort accessors by ReceiverType.FieldName
	sort.Sort(byName(t.Accessors))

	var buf bytes.Buffer
	if err := sourceTmpl.Execute(&buf, t); err != nil {
		return err
	}
	clean, err := format.Source(buf.Bytes())
	if err != nil {
		return err
	}

	outFile := filepath.Join(filepath.Dir(t.sourceFile), t.Filename)
	logf("Writing %v...", outFile)
	return ioutil.WriteFile(outFile, clean, 0644)
}
func (t *templateData) dump() error {
	if len(t.Accessors) == 0 {
		logf("No accessors for %v; skipping.", t.Filename)
		return nil
	}

	
	sort.Sort(byName(t.Accessors))

	var buf bytes.Buffer
	if err := sourceTmpl.Execute(&buf, t); err != nil {
		return err
	}
	clean, err := format.Source(buf.Bytes())
	if err != nil {
		return err
	}

	outFile := filepath.Join(filepath.Dir(t.sourceFile), t.Filename)
	logf("Writing %v...", outFile)
	return ioutil.WriteFile(outFile, clean, 0644)
}
func ( t * templateData ) dump ( ) error { if len ( t . Accessors ) == 0 { logf ( " " , t . Filename ) return nil } // Sort accessors by ReceiverType.FieldName sort . Sort ( byName ( t . Accessors ) ) var buf bytes . Buffer if err := sourceTmpl . Execute ( & buf , t ) ; err != nil { return err } clean , err := format . Source ( buf . Bytes ( ) ) if err != nil { return err } outFile := filepath . Join ( filepath . Dir ( t . sourceFile ) , t . Filename ) logf ( " " , outFile ) return ioutil . WriteFile ( outFile , clean , 0644 ) }
// dump sorts the results, and writes the generated code to a file
dump sorts the results and writes the generated code to a file