diff --git a/generator.go b/generator.go index d60f688..9442411 100644 --- a/generator.go +++ b/generator.go @@ -40,7 +40,6 @@ func Init(opts ...InitOption) *Generator { g.Debugger = initDebugger(g.debug, log.New(os.Stderr, "", 0)) g.persister.SetDebugger(g.Debugger) - g.persister.SetOutputPath(g.params.OutputPath()) return g } diff --git a/workflow.go b/workflow.go index fb30a50..a98daed 100644 --- a/workflow.go +++ b/workflow.go @@ -40,6 +40,7 @@ func (wf *standardWorkflow) Init(g *Generator) AST { for _, pm := range wf.paramMutators { pm(wf.params) } + wf.persister.SetOutputPath(wf.params.OutputPath()) if wf.BiDi { return ProcessCodeGeneratorRequestBidirectional(g, req) diff --git a/workflow_test.go b/workflow_test.go index 258ac43..07fe6f2 100644 --- a/workflow_test.go +++ b/workflow_test.go @@ -19,10 +19,14 @@ func TestStandardWorkflow_Init(t *testing.T) { mutated := false - g := Init(ProtocInput(bytes.NewReader(b)), MutateParams(func(p Parameters) { mutated = true })) + g := Init(ProtocInput(bytes.NewReader(b)), MutateParams(func(p Parameters) { + mutated = true + p["output_path"] = "output/path" + })) g.workflow.Init(g) assert.True(t, mutated) + assert.Equal(t, "output/path", g.params.OutputPath()) t.Run("bidi", func(t *testing.T) { mutated = false