mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-16 23:48:27 +00:00
Support extra --out-format args
This commit is contained in:
parent
8c13ec4e5d
commit
4601e576f2
2 changed files with 8 additions and 2 deletions
|
|
@ -34,6 +34,10 @@ inputs:
|
|||
description: "if set to true then the action doesn't cache or restore ~/.cache/go-build."
|
||||
default: false
|
||||
required: false
|
||||
allow-extra-out-format-args:
|
||||
description: "if set to true then the action allows additional --out-format args (default of --out-format=github-actions remains)"
|
||||
default: false
|
||||
required: false
|
||||
runs:
|
||||
using: "node16"
|
||||
main: "dist/run/index.js"
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||
}
|
||||
|
||||
const userArgs = core.getInput(`args`)
|
||||
const allowExtraOutFormatArgs = core.getInput(`allow-extra-out-format-args`)
|
||||
const addedArgs: string[] = []
|
||||
|
||||
const userArgNames = new Set<string>(
|
||||
|
|
@ -127,8 +128,9 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||
.filter((arg) => arg.startsWith(`-`))
|
||||
.map((arg) => arg.replace(/^-+/, ``))
|
||||
)
|
||||
if (userArgNames.has(`out-format`)) {
|
||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
||||
if (userArgNames.has(`out-format`) && !allowExtraOutFormatArgs) {
|
||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a
|
||||
future version (set 'allow-extra-out-format-args' input to true to override)`)
|
||||
}
|
||||
addedArgs.push(`--out-format=github-actions`)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue