Skip to content

PMM-15129 PMM-15129 Fix noinlineerr Go linter issues in agent#5483

Merged
maxkondr merged 16 commits into
v3from
PMM-15129-noinlineerr-linter-agent
Jun 11, 2026
Merged

PMM-15129 PMM-15129 Fix noinlineerr Go linter issues in agent#5483
maxkondr merged 16 commits into
v3from
PMM-15129-noinlineerr-linter-agent

Conversation

@maxkondr

Copy link
Copy Markdown
Contributor

@maxkondr maxkondr requested a review from Copilot June 10, 2026 15:30
@maxkondr maxkondr self-assigned this Jun 10, 2026
@maxkondr maxkondr requested a review from a team as a code owner June 10, 2026 15:30
@maxkondr maxkondr requested review from 4nte and JiriCtvrtka and removed request for a team June 10, 2026 15:30

Copilot AI left a comment

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.

Pull request overview

This PR addresses Go linter (noinlineerr) warnings across the PMM agent/admin code by refactoring inline error checks (e.g., if err := ...; err != nil) into separate assignment + conditional blocks, without changing intended behavior.

Changes:

  • Replaced inline if err := ...; err != nil patterns with err = ... / if err != nil across agent, admin, and API packages.
  • Adjusted a few spots where := previously scoped variables tightly (e.g., command responses, DB calls, file ops) to satisfy the linter’s requirements.
  • Minor import and local variable handling updates to support the refactors.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
api/agent/v1/metadata.go Refactors metrics port parsing to avoid inline error initialization.
agent/utils/version/mongo.go Splits MongoDB command error/decode checks into assignment + conditional.
agent/utils/tests/mongodb.go Refactors decode error handling in test utility.
agent/utils/templates/template.go Refactors temp dir cleanup/create error handling to satisfy linter.
agent/utils/filereader/continuous_file_reader.go Refactors file seek/close error handling to avoid inline err declarations.
agent/serviceinfobroker/service_info_broker.go Refactors DB ping/query/scan error checks across service info helpers.
agent/runner/runner.go Refactors token acquisition error checks for jobs/actions.
agent/runner/jobs/mysql_restore_job.go Refactors multiple restore-step error checks (systemctl, exec, filesystem).
agent/runner/jobs/mysql_backup_job.go Refactors command start error checks during backup pipeline setup.
agent/runner/jobs/mongodb_restore_job.go Refactors PBM configuration/wait error checks.
agent/runner/jobs/mongodb_backup_job.go Refactors PBM configuration/wait error checks.
agent/runner/actions/pt_mysql_summary_action.go Refactors arg validation and template execution error checks.
agent/runner/actions/mysql_show_create_table_action.go Refactors row scan error check.
agent/runner/actions/mysql_explain_action.go Refactors write/flush/unmarshal error checks to avoid inline err declarations.
agent/runner/actions/mongodb_query_admincommand_action.go Refactors BSON decode error check.
agent/connectionchecker/connection_checker.go Refactors ping checks for MySQL/MongoDB/PostgreSQL/ProxySQL.
agent/config/config.go Refactors host/port parsing and config loading/unmarshal error checks.
agent/commands/setup.go Refactors error checks and updates typed error extraction patterns for linter compliance.
agent/cmd/pmm-agent-entrypoint/main.go Refactors signal/process waiting and prerun command error checks.
agent/client/client.go Refactors timeout validity check to avoid inline err declaration.
agent/agents/supervisor/supervisor.go Refactors port release and temp dir cleanup error handling.
agent/agents/postgres/pgstatstatements/pgstatstatements.go Refactors cache get/set error handling around stat statement refresh.
agent/agents/postgres/pgstatmonitor/pgstatmonitor.go Refactors initial cache seeding error handling.
agent/agents/postgres/parser/parser.go Refactors parse-to-JSON error handling.
agent/agents/mysql/slowlog/slowlog.go Refactors multiple query/scan/fs operations error handling in slowlog checks/rotation.
agent/agents/mysql/perfschema/perfschema.go Refactors cache get/set and initial summary fetch error handling.
agent/agents/mongodb/mongolog/internal/monitor_test.go Refactors scanner/write error checks in tests.
agent/agentlocal/agent_local.go Refactors JSON gateway registration and HTTP server shutdown error checks.
agent/agentlocal/agent_local_test.go Refactors zip entry read error check in test.
admin/commands/summary.go Refactors URL parse and archive file create error checks.
admin/commands/status.go Refactors URL parse error check when redacting server URL.
admin/commands/base.go Refactors JSON unmarshal error check for credentials parsing.
admin/cmd/pmm-admin/main_test.go Refactors JSON unmarshal error check in version output test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.57143% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.51%. Comparing base (0fcef19) to head (6887260).

Files with missing lines Patch % Lines
agent/runner/jobs/mysql_restore_job.go 0.00% 32 Missing ⚠️
agent/commands/setup.go 0.00% 9 Missing ⚠️
agent/agents/mysql/slowlog/slowlog.go 53.33% 1 Missing and 6 partials ⚠️
agent/cmd/pmm-agent-entrypoint/main.go 0.00% 7 Missing ⚠️
agent/agents/mysql/perfschema/perfschema.go 40.00% 2 Missing and 4 partials ⚠️
agent/runner/jobs/mongodb_backup_job.go 0.00% 6 Missing ⚠️
agent/runner/jobs/mongodb_restore_job.go 0.00% 6 Missing ⚠️
agent/agentlocal/agent_local.go 0.00% 4 Missing ⚠️
...ents/postgres/pgstatstatements/pgstatstatements.go 33.33% 2 Missing and 2 partials ⚠️
agent/runner/jobs/mysql_backup_job.go 0.00% 4 Missing ⚠️
... and 14 more
Additional details and impacted files
@@                           Coverage Diff                            @@
##           PMM-15129-noinlineerr-linter-managed    #5483      +/-   ##
========================================================================
- Coverage                                 43.52%   43.51%   -0.01%     
========================================================================
  Files                                       413      413              
  Lines                                     42849    42928      +79     
========================================================================
+ Hits                                      18648    18682      +34     
- Misses                                    22329    22374      +45     
  Partials                                   1872     1872              
Flag Coverage Δ
admin 34.78% <50.00%> (+0.03%) ⬆️
agent 49.04% <35.92%> (-0.09%) ⬇️
managed 42.86% <ø> (+0.01%) ⬆️
vmproxy 72.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from PMM-15129-noinlineerr-linter-managed to v3 June 11, 2026 10:40
@maxkondr maxkondr merged commit 0e531ee into v3 Jun 11, 2026
29 checks passed
@maxkondr maxkondr deleted the PMM-15129-noinlineerr-linter-agent branch June 11, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants