Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Apr 25, 2024
1 parent b99879a commit a4539c3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ const getLintCacheDir = (): string => {
return path.resolve(`${process.env.HOME}/.cache/golangci-lint`)
}

const getCacheDirs = (): string[] => {
return [getLintCacheDir()]
}

const getIntervalKey = (invalidationIntervalDays: number): string => {
const now = new Date()
const secondsSinceEpoch = now.getTime() / 1000
Expand Down Expand Up @@ -81,7 +77,7 @@ export async function restoreCache(): Promise<void> {
}
core.saveState(State.CachePrimaryKey, primaryKey)
try {
const cacheKey = await cache.restoreCache(getCacheDirs(), primaryKey, restoreKeys)
const cacheKey = await cache.restoreCache([getLintCacheDir()], primaryKey, restoreKeys)
if (!cacheKey) {
core.info(`Cache not found for input keys: ${[primaryKey, ...restoreKeys].join(", ")}`)
return
Expand Down Expand Up @@ -111,7 +107,7 @@ export async function saveCache(): Promise<void> {

const startedAt = Date.now()

const cacheDirs = getCacheDirs()
const cacheDirs = [getLintCacheDir()]
const primaryKey = core.getState(State.CachePrimaryKey)
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`)
Expand Down

0 comments on commit a4539c3

Please sign in to comment.