Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,48 @@
# limitations under the License.

---
version: "2"

run:
build-tags:
- acceptance
- generative
- integration
- unit

linters:
enable:
- gci
- goimports
- gosec
- misspell
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/conforma/cli)
- staticcheck
settings:
gosec:
excludes:
- G122
- G702
- G703
staticcheck:
checks:
- "all"
- "-QF*"
- "-ST*"
exclusions:
presets:
- comments
- common-false-positives
- legacy
- std-error-handling

formatters:
enable:
- gci
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/conforma/cli)

issues:
exclude-rules: []
exclude-generated: lax
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,17 @@ lint: tekton-lint go-mod-lint ## Run linter
@go run -modfile tools/go.mod github.com/google/addlicense -c '$(COPY)' -y '' -s -check $(LICENSE_IGNORE) . | sed 's/^/Missing license header in: /g'
# piping to sed above looses the exit code, luckily addlicense is fast so we invoke it for the second time to exit 1 in case of issues
@go run -modfile tools/go.mod github.com/google/addlicense -c '$(COPY)' -y '' -s -check $(LICENSE_IGNORE) . >/dev/null 2>&1
@go run -modfile tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --sort-results $(if $(GITHUB_ACTIONS), --timeout=10m0s)
@(cd acceptance && go run -modfile ../tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --path-prefix acceptance --sort-results $(if $(GITHUB_ACTIONS), --timeout=10m0s))
@go run -modfile tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run $(if $(GITHUB_ACTIONS), --timeout=10m0s)
@(cd acceptance && go run -modfile ../tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run --path-prefix acceptance $(if $(GITHUB_ACTIONS), --timeout=10m0s))
Comment on lines +210 to +211
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. No local lint timeout 🐞 Bug ☼ Reliability

make lint only applies --timeout when GITHUB_ACTIONS is set, so local runs (and any non-GitHub
CI) can run indefinitely under golangci-lint v2. This can hang developer workflows when analysis
stalls or is unusually slow.
Agent Prompt
## Issue description
`make lint` (and the acceptance subdir lint) only sets `--timeout` when `GITHUB_ACTIONS` is present. With golangci-lint v2 having no default timeout, local/non-GHA runs can hang indefinitely.

## Issue Context
This is a workflow reliability regression after moving to golangci-lint v2.

## Fix Focus Areas
- Update `Makefile` to always pass a timeout (optionally configurable via a make var, e.g. `LINT_TIMEOUT ?= 10m0s`), and use it in both the root and `acceptance/` golangci-lint invocations.

### Fix locations
- Makefile[194-207]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


.PHONY: lint-fix
lint-fix: ## Fix linting issues automagically
@go run -modfile tools/go.mod github.com/google/addlicense -c '$(COPY)' -y '' -s $(LICENSE_IGNORE) .
@go run -modfile tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --fix
@(cd acceptance && go run -modfile ../tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --path-prefix acceptance --fix)
@go run -modfile tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run --fix
@(cd acceptance && go run -modfile ../tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run --path-prefix acceptance --fix)
# We don't apply the fixes from the internal (error handling) linter.
# TODO: fix the outstanding error handling lint issues and enable the fixer
# @go run -modfile tools/go.mod ./internal/lint -fix $$(go list ./... | grep -v '/acceptance/')
@go run -modfile tools/go.mod github.com/daixiang0/gci write -s standard -s default -s "prefix(github.com/conforma/cli)" .

node_modules: package-lock.json
@npm ci
Expand Down
Loading
Loading