jotadrilo/go-factory

Support multiple inline annotations in the same file

Opened this issue · 0 comments

Today, when a file contains multiple structs with an inline go:generate annotation, go-factory is invoked independently for each one. As a result, only the last annotation is preserved in the output factory file.

Expectations

The examples/abc.go file should render a examples/abc_factory.go file with factories for A, B, and C structs, not only for C.

Workaround

We can define a .gofactory.yaml file with the following content:

packages:
  - name: github.com/jotadrilo/go-factory/examples
    include:
      - A
      - B
      - C