Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.22', '1.23', '1.24']
go-version: ['1.24']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -41,6 +41,6 @@ jobs:
go-version: '1.24'

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v9
with:
version: latest
version: v2.12.2
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
run: gotestsum --format=testdox -- -race ./...

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v9
with:
version: latest
version: v2.12.2

release:
needs: validate
Expand Down
58 changes: 43 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
run:
timeout: 5m
version: "2"

linters:
# Default v2 linter set: errcheck, govet, ineffassign, staticcheck, unused.
# gofmt and goimports moved to formatters in v2 (configured below).
settings:
errcheck:
exclude-functions:
- (io.Closer).Close
- (*os.File).Close
- os.Chmod
- os.MkdirAll
- (github.com/sageox/agentx.Registry).Register
- (*github.com/sageox/agentx.DefaultRegistryImpl).Register
- (github.com/sageox/agentx.Environment).Remove
- fmt.Sscanf
Comment on lines +7 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Excluding error checks creates technical debt and potential correctness risks.

The exclude-functions list suppresses error checking for operations that can fail in production:

  • os.Chmod, os.MkdirAll - filesystem permission/creation failures
  • (io.Closer).Close, (*os.File).Close - resource cleanup failures
  • Registry.Register - registration failures
  • fmt.Sscanf - parse failures

While the PR objectives acknowledge ~30 production-path errcheck warnings are hidden, these exclusions can mask real bugs. For example, unhandled MkdirAll failures could lead to subsequent file-write crashes, and ignored Register errors could result in missing agent registrations at runtime.

Consider auditing each suppressed case to either explicitly ignore (with inline _ = ... and comment), propagate errors, or log them. This addresses the technical debt before it compounds.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.golangci.yml around lines 7 - 16, The .golangci.yml excludes suppress error
checks for operations like (io.Closer).Close, (*os.File).Close, os.Chmod,
os.MkdirAll, (github.com/sageox/agentx.Registry).Register,
(*github.com/sageox/agentx.DefaultRegistryImpl).Register,
(github.com/sageox/agentx.Environment).Remove and fmt.Sscanf which can mask real
failures; remove these entries and audit each call site: for each use of
Close/Chmod/MkdirAll/Register/Remove/Sscanf either (a) propagate the error to
the caller, (b) handle and log the error where it occurs, or (c) explicitly
ignore it with `_ = ...` plus a short comment why ignoring is safe; after
changes run golangci-lint to confirm warnings are fixed and keep only deliberate
`_ =` ignores documented inline.

exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
rules:
# Test files routinely use Close/Chmod/Register without error checks
# for setup and cleanup. Those errors aren't actionable in tests.
- path: _test\.go
linters:
- errcheck
# QF1011 flags `var _ Iface = impl` interface-conformance assertions,
# but the explicit type is the whole point of the pattern.
- text: "QF1011"
linters:
- staticcheck

formatters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- gofmt
- goimports

linters-settings:
goimports:
local-prefixes: github.com/sageox/agentx

issues:
exclude-use-default: false
settings:
goimports:
local-prefixes:
- github.com/sageox/agentx
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
Comment on lines +1 to +48

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the v2 configuration against golangci-lint's schema

# Check if the config is valid by running golangci-lint with --version to see output
golangci-lint --version 2>/dev/null || echo "golangci-lint not installed in sandbox"

# Look for any example v2 configs or migration documentation in the repo
fd -e yml -e yaml golangci | head -20

Repository: sageox/agentx

Length of output: 148


🌐 Web query:

Is golangci-lint-action@v6 compatible with golangci-lint configuration version 2 format?

💡 Result:

No, golangci-lint-action@v6 is not compatible with golangci-lint configuration version 2 format. It is restricted to golangci-lint v1.x versions, which use config version 1.[1][2] Attempting to use golangci-lint v2 (which requires config version: "2"[3][4][5]) with v6 will throw an error: "golangci-lint v2 is not supported by golangci-lint-action v6, you must update to golangci-lint-action v7."[1] v7.0.0 and later support golangci-lint v2 only.[6] The action added JSONSchema verification (default true in later v6 releases), which fails on v2 configs with v1 tooling.[7][8]

Citations:


🌐 Web query:

golangci-lint version 2 configuration format syntax for linters.settings and formatters sections

💡 Result:

In golangci-lint version 2, the configuration uses YAML format (also supports TOML/JSON). The top-level sections are linters and formatters, each with a settings subsection for per-linter/formatter options [1][2][3]. linters.settings syntax: Nested map where keys are linter names (lowercase, matching golangci-lint linters output) and values are linter-specific options as maps or primitives. Example: linters: settings: asasalint: exclude: - Append - \.Wrapf use-builtin-exclusions: false depguard: rules: main: list-mode: lax files: - $all allow: - $gostd [2][1] formatters.settings syntax: Nested map where keys are formatter names (e.g., gci, gofmt, gofumpt, goimports, golines, swaggo) and values are formatter-specific options. Example: formatters: settings: gci: sections: - standard - default - prefix(github.com/org/project) no-inline-comments: true custom-order: true goimports: local-prefixes: - github.com/my/project golines: max-len: 120 [3][4][5] Full reference in https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml [1][6]. Use golangci-lint linters or golangci-lint formatters for lists. Config starts with version: "2" [1].

Citations:


🏁 Script executed:

fd -e yml -e yaml | xargs grep -l "golangci-lint-action" 2>/dev/null | head -10

Repository: sageox/agentx

Length of output: 39


🏁 Script executed:

find .github/workflows -type f -name "*.yml" -o -name "*.yaml" 2>/dev/null | xargs cat 2>/dev/null | grep -A2 -B2 "golangci" 2>/dev/null || echo "No workflows found or no golangci references"

Repository: sageox/agentx

Length of output: 376


Incompatible action version for v2 configuration format.

The .golangci.yml file uses version: "2", but the workflow files reference golangci/golangci-lint-action@v6, which only supports golangci-lint v1.x configuration. This will cause CI failures with the error: "golangci-lint v2 is not supported by golangci-lint-action v6, you must update to golangci-lint-action v7."

Update the workflow files to use golangci/golangci-lint-action@v7 or later, or downgrade .golangci.yml to v1 configuration format.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.golangci.yml around lines 1 - 48, The CI failure comes from using
golangci-lint v2 config (version: "2" in .golangci.yml) while workflows
reference golangci/golangci-lint-action@v6 which only supports v1; either update
all workflow job steps that reference golangci/golangci-lint-action@v6 to use
golangci/golangci-lint-action@v7 (or later) so the action supports v2 config, or
change the config version in .golangci.yml from "2" to the v1-compatible format
(version: "1") to match the existing `@v6` action—search for occurrences of
golangci/golangci-lint-action@v6 in your workflow files or the version: "2" key
in .golangci.yml to locate where to change.

Loading