fix: get correct home dir on Windows

This commit is contained in:
Zxilly 2024-07-02 21:48:31 +08:00
parent d8028e1f20
commit c95b6ec852
No known key found for this signature in database
GPG key ID: 47AB1DEC841BC6A2

View file

@ -20,7 +20,9 @@ function checksumFile(hashName: string, path: string): Promise<string> {
const pathExists = async (path: string): Promise<boolean> => !!(await fs.promises.stat(path).catch(() => false))
const getLintCacheDir = (): string => {
return path.resolve(`${process.env.HOME}/.cache/golangci-lint`)
const home = process.platform === "win32" ? "USERPROFILE" : "HOME"
return path.resolve(`${home}/.cache/golangci-lint`)
}
const getIntervalKey = (invalidationIntervalDays: number): string => {