How to invalid nx cache when go version changes or in different environments #115
Unanswered
phillipCouto
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Figure I would share this little tweak my team added to our nx-go project.json to invalid the cache when the go version changes or when the cache was built in one os / arch that does not match the current os / arch.
We can use the
go version
command output to be included in the hash for the cache of a target so that a distributed cache is busted when a new version of go is released or the command is ran in a different environment here is an example of the command output:Add
{"runtime": "go version"}
to theinputs
array for the target to have nx execute thego version
command to include the go version, OS, and architecture in the hash that identifies the cache. This way if any part of the go version string changes it will invalidate the cache ensuring nx runs the target.Example:
Beta Was this translation helpful? Give feedback.
All reactions