// newGeneration constructs a generation which will look for the
// named interface types in the given directory.
newGeneration constructs a generation which will look for the
named interface types in the given directory.
// newGeneration constructs a generation which will look for the // named interface types in the given directory .
func newGeneration(cfg config) (*generation, error) {
	if len(cfg.typeNames) > 1 && cfg.union == "" {
		return nil, errors.New("multiple input types can only be used with --union")
	}
	if cfg.reachable && cfg.union == "" {
		return nil, errors.New("--reachable can only be used with --union")
	}
	return &generation{
		config: cfg,
		writeCloser: func(name string) (io.WriteCloser, error) {
			if name == "-" {
				return os.Stdout, nil
			}
			return os.OpenFile(name, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
		},
	}, nil
}
func newGeneration ( cfg config ) ( * generation , error ) { if len ( cfg . typeNames ) > 1 && cfg . union == " " { return nil , errors . New ( " " ) } if cfg . reachable && cfg . union == " " { return nil , errors . New ( " " ) } return & generation { config : cfg , writeCloser : func ( name string ) ( io . WriteCloser , error ) { if name == " " { return os . Stdout , nil } return os . OpenFile ( name , os . O_CREATE | os . O_TRUNC | os . O_WRONLY , 0644 ) } , } , nil }
newGeneration constructs a generation which will look for the
named interface types in the given directory.
newGeneration constructs a generation which will look for the named interface types in the given directory .