// newGenerationForTesting creates a generator that captures
// its output in the provided map.
newGenerationForTesting creates a generator that captures
its output in the provided map.
// newGenerationForTesting creates a generator that captures // its output in the provided map .
func newGenerationForTesting(cfg config, outputs map[string][]byte) (*generation, error) {
	g, err := newGeneration(cfg)
	if err != nil {
		return nil, err
	}
	var mu sync.Mutex
	g.writeCloser = func(name string) (io.WriteCloser, error) {
		name, err := filepath.Abs(name)
		if err != nil {
			return nil, err
		}
		return newMapWriter(name, &mu, outputs), nil
	}
	return g, nil
}
func newGenerationForTesting ( cfg config , outputs map [ string ] [ ] byte ) ( * generation , error ) { g , err := newGeneration ( cfg ) if err != nil { return nil , err } var mu sync . Mutex g . writeCloser = func ( name string ) ( io . WriteCloser , error ) { name , err := filepath . Abs ( name ) if err != nil { return nil , err } return newMapWriter ( name , & mu , outputs ) , nil } return g , nil }
newGenerationForTesting creates a generator that captures
its output in the provided map.
newGenerationForTesting creates a generator that captures its output in the provided map .
// Use absolute filenames for compatibility with package overlay.