Running into a weird caching issue on v1.2.0 (from go.mod, github.com/goforj/wire v1.2.0).
Setup: monorepo with go.work, each app has its own cmd package with an injector. Wire runs via go tool github.com/goforj/wire/cmd/wire gen <targets> from another module in the workspace.
I refactored a bunch of providers — changed constructor signatures and deleted an options struct they used to take. Regenerating with multiple targets in one call:
wire gen ../libs/baseapp ../apps/eventsub/cmd
writes a wire_gen.go that still calls the OLD signatures (references the deleted struct, does not compile). Sometimes it even prints "unchanged" for a file that obviously cannot be current.
The exact same command with a single target:
wire gen ../apps/eventsub/cmd
produces correct output. Deleting the existing wire_gen.go first also forces correct output. This is 100% reproducible in my repo: every multi-target run was stale, every single-target run was correct. WIRE_CACHE_MODE=content also made the multi-target run produce correct output (though that might just be because the mode is part of the cache key, so it was a guaranteed miss).
Suspect the persistent cache in ~/.cache/wire (default mtime mode). Looking at outputCacheKey, non-local packages contribute only their ExportFile path to the key — maybe in the multi-package path some packages end up treated as non-local and their stale analysis gets reused?
Versions: wire v1.2.0, go1.26.3 linux/amd64, go.work workspace.
Workaround for now: generate each package in its own process, plus WIRE_CACHE_MODE=content.
Running into a weird caching issue on v1.2.0 (from go.mod, github.com/goforj/wire v1.2.0).
Setup: monorepo with go.work, each app has its own cmd package with an injector. Wire runs via
go tool github.com/goforj/wire/cmd/wire gen <targets>from another module in the workspace.I refactored a bunch of providers — changed constructor signatures and deleted an options struct they used to take. Regenerating with multiple targets in one call:
writes a wire_gen.go that still calls the OLD signatures (references the deleted struct, does not compile). Sometimes it even prints "unchanged" for a file that obviously cannot be current.
The exact same command with a single target:
produces correct output. Deleting the existing wire_gen.go first also forces correct output. This is 100% reproducible in my repo: every multi-target run was stale, every single-target run was correct.
WIRE_CACHE_MODE=contentalso made the multi-target run produce correct output (though that might just be because the mode is part of the cache key, so it was a guaranteed miss).Suspect the persistent cache in ~/.cache/wire (default mtime mode). Looking at outputCacheKey, non-local packages contribute only their ExportFile path to the key — maybe in the multi-package path some packages end up treated as non-local and their stale analysis gets reused?
Versions: wire v1.2.0, go1.26.3 linux/amd64, go.work workspace.
Workaround for now: generate each package in its own process, plus WIRE_CACHE_MODE=content.