I'm trying to write a test to verify that pkged.go matches the contents of my resource directory, which I can then incorporate into a CI pipeline to make sure the generated code committed to the repo is up to date.
Unfortunately, my first naive attempt (using filepath.Walk() to walk the resource directory, and comparing the contents with the results from pkger.Open) made it clear that pkger.Open is just reading the source directory, not the packaged data in pkged.go. (E.g., the test still passes if I add a new file to the resource directory after packaging.) In fact, as far as I can tell, in test, the code in pkged.go (pkger.Apply() etc.) isn't even being executed.
How can I convince pkger to read the packaged data? Or am I fundamentally misunderstanding something here?
I'm trying to write a test to verify that
pkged.go
matches the contents of my resource directory, which I can then incorporate into a CI pipeline to make sure the generated code committed to the repo is up to date.Unfortunately, my first naive attempt (using
filepath.Walk()
to walk the resource directory, and comparing the contents with the results frompkger.Open
) made it clear thatpkger.Open
is just reading the source directory, not the packaged data inpkged.go
. (E.g., the test still passes if I add a new file to the resource directory after packaging.) In fact, as far as I can tell, in test, the code inpkged.go
(pkger.Apply()
etc.) isn't even being executed.How can I convince
pkger
to read the packaged data? Or am I fundamentally misunderstanding something here?