feat: use absolute paths by default when using working-directory option (#1231)
This commit is contained in:
committed by
GitHub
parent
9fae48acfc
commit
7774f98a88
@@ -123,9 +123,11 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
||||
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||
throw new Error(`working-directory (${workingDirectory}) was not a path`)
|
||||
}
|
||||
if (!userArgNames.has(`path-prefix`)) {
|
||||
addedArgs.push(`--path-prefix=${workingDirectory}`)
|
||||
|
||||
if (!userArgNames.has(`path-prefix`) && !userArgNames.has(`path-mode`)) {
|
||||
addedArgs.push(`--path-mode=abs`)
|
||||
}
|
||||
|
||||
cmdArgs.cwd = path.resolve(workingDirectory)
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ const parseVersion = (s: string): Version => {
|
||||
}
|
||||
|
||||
if (parseInt(match[1]) !== 2) {
|
||||
throw new Error(`invalid version string '${s}', golangci-lint v${match[1]} is not supported by golangci-lint-action v7.`)
|
||||
throw new Error(`invalid version string '${s}', golangci-lint v${match[1]} is not supported by golangci-lint-action >= v7.`)
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -45,7 +45,7 @@ export const stringifyVersion = (v: Version): string => {
|
||||
|
||||
const minVersion = {
|
||||
major: 2,
|
||||
minor: 0,
|
||||
minor: 1,
|
||||
patch: 0,
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ const isLessVersion = (a: Version, b: Version): boolean => {
|
||||
return a.major < b.major
|
||||
}
|
||||
|
||||
// Do not compare patch parts because if the min version has a non zero value
|
||||
// Do not compare patch parts because if the min version has a non-zero value
|
||||
// then it returns false, since the patch version of requested is always zero
|
||||
return a.minor < b.minor
|
||||
}
|
||||
|
Reference in New Issue
Block a user