Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: Allowing to change the output file name from wire_gen.go to other #213

Merged
merged 4 commits into from Sep 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/wire/wire.go
Expand Up @@ -63,7 +63,8 @@ func (gen GenerateResult) Commit() error {
// GenerateOptions holds options for Generate.
type GenerateOptions struct {
// Header will be inserted at the start of each generated file.
Header []byte
Header []byte
OutputFile string
}

// Generate performs dependency injection for the packages that match the given
Expand Down Expand Up @@ -94,7 +95,7 @@ func Generate(ctx context.Context, wd string, env []string, patterns []string, o
generated[i].Errs = append(generated[i].Errs, err)
continue
}
generated[i].OutputPath = filepath.Join(outDir, "wire_gen.go")
generated[i].OutputPath = filepath.Join(outDir, opts.OutputFile)
vangent marked this conversation as resolved.
Show resolved Hide resolved
g := newGen(pkg)
injectorFiles, errs := generateInjectors(g, pkg)
if len(errs) > 0 {
Expand Down