wire icon indicating copy to clipboard operation
wire copied to clipboard

--header_file flag is not in generated codeg

Open poy opened this issue 6 years ago • 7 comments
trafficstars

Describe the bug

When using the --header_file flag the resulting generated file has the following go generate line:

//go:generate wire

This implies when someone later runs go generate ./..., the header file that was originally in the file will be removed.

To Reproduce

wire --header_file=./path/to/header/file
go generate

Expected behavior

After running wire with the --header_file flag, running go generate again would not produce a delta.

Version

v0.3.0

Additional context

poy avatar Jul 12 '19 20:07 poy

How would you expect this to work? Would you want wire to emit something like

go:generate wire --header_file=./path/to/header/file

? That path may not exist for a subsequent call to go generate....

vangent avatar Jul 12 '19 23:07 vangent

I think I would want that or an option to not include the go generate line

poy avatar Jul 13 '19 01:07 poy

WDYT about always omitting the //go:generate wire line if a header is provided? It seems like a signal that the user is not actually using go generate to generate the file, but some other script/process.

vangent avatar Jul 15 '19 23:07 vangent

@zombiezen

vangent avatar Jul 15 '19 23:07 vangent

I am bit concerned to add too much logic here: folks that use Wire in complex builds should likely be using a tool more sophisticated than go generate.

zombiezen avatar Jul 16 '19 18:07 zombiezen

Does that imply the go generate line should be removed from the generated output?

poy avatar Jul 18 '19 05:07 poy

--output_file_prefix has the same issue.

xwjdsh avatar Sep 27 '19 06:09 xwjdsh