Skip to content

Conversation

@hori-ryota
Copy link
Contributor

Currently cache conflicts in monorepo.

Use working-directory as cache key prefix to separate cache per working direcitories.

2. The primary caching key looks like `golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}`. Interval number ensures that we periodically invalidate
our cache (every 7 days). `go.mod` hash ensures that we invalidate the cache early - as soon as dependencies have changed.
3. We use [restore keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key): `golangci-lint.cache-{interval_number}-`, `golangci-lint.cache-`. GitHub matches keys by prefix if we have no exact match for the primary cache.
2. The primary caching key looks like `golangci-lint.cache-{interval_number}-{go.mod_hash}` (with `working-directory`, key will be `golangci-lint.cache-${working-directory}-{interval_number}-{go.mod_hash}`).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, working-directory must be specified before interval_number.

If reversed, restore key without working-directory will be golangci-lint.cache-{interval_number}- that is prefix of golangci-lint.cache-{interval_number}-{working-directory}-. Leads to wrong restore.

@ldez ldez added the enhancement New feature or request label Apr 18, 2023
@ldez ldez closed this in #1032 May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants