Is it possible to use context to manage data between WalkFunc invocations? For example, a recursive file linter wishing to report warnings for lots of nodes, but also remember the warning count at the end, could use something like context to maintain this state.
Could someone provide an example of a reasonably idiomatic way to store state during filepath.Walk?
Don’t use a context for that. Make the walk function a method of a suitable type and track the state on that type, or something similar. Contexts are for cancellation, and if you want to be able to cancel the walk you might want one. But not for tracking the totals.