Skip to content

fix: remove unused buildCanonicalFrontmatter function#19244

Merged
pelikhan merged 2 commits intomainfrom
copilot/remove-dead-function-lint
Mar 2, 2026
Merged

fix: remove unused buildCanonicalFrontmatter function#19244
pelikhan merged 2 commits intomainfrom
copilot/remove-dead-function-lint

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

golangci-lint's unused checker flagged buildCanonicalFrontmatter in pkg/parser/frontmatter_hash.go, breaking the lint-go CI job. The function lost all its call sites when the parser was refactored to use the text-based hashing approach (computeFrontmatterHashTextBasedWithReader).

Changes

  • pkg/parser/frontmatter_hash.go — deleted the dead buildCanonicalFrontmatter function (101 lines); the text-based hashing path fully replaces its role.
Original prompt

This section details on the original issue you should resolve

<issue_title>[CI Failure Doctor] CI Failure Investigation - Run #38509</issue_title>
<issue_description>### Summary
The lint-go job failed because golangci-lint reported the helper buildCanonicalFrontmatter in pkg/parser/frontmatter_hash.go as unused even though the rest of the parser no longer calls it. Removing this dead function keeps the lint suite happy.

Failure Details

Root Cause Analysis

golangci-lint unused flagged buildCanonicalFrontmatter because the function is still defined even though every call site went away in the recent refactor. The lint job fails before we hit any other checks.

Failed Jobs and Errors

  • lint-go: pkg/parser/frontmatter_hash.go:43:6: func buildCanonicalFrontmatter is unused (unused)
Investigation Findings - The failure occurs inside `make lint` when `golangci-lint` runs `unused`. - Removing `buildCanonicalFrontmatter` and its documentation entry resolves the unused symbol. - Attempted local validation (`GOTOOLCHAIN=local make fmt` and `make lint`) but both commands fail in this environment because Go 1.25 cannot be downloaded and `golangci-lint` is not installed; these constraints will need to be addressed when verifying locally.

Recommended Actions

  • Delete any remaining references to buildCanonicalFrontmatter and ensure the parser does not reintroduce it.
  • Re-run GOTOOLCHAIN=local make fmt and GOTOOLCHAIN=local make lint (or the full make agent-finish) once the Go 1.25 toolchain and golangci-lint are available in the environment.

Prevention Strategies

Before running future dead-code-removal batches in the parser, clean up the helper definitions as soon as deadcode reports them so golangci-lint does not trip over stale symbols.

AI Team Self-Improvement

When removing parser helpers, proactively run the golangci-lint suite (or at least make lint) in a Go 1.25 environment to catch unused-symbol failures before pushing.

Historical Context No previous investigations with this exact failure signature were found in the recent CI history.

🩺 Diagnosis provided by CI Failure Doctor

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d
  • expires on Mar 3, 2026, 2:47 PM UTC

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove unused buildCanonicalFrontmatter function fix: remove unused buildCanonicalFrontmatter function Mar 2, 2026
@pelikhan pelikhan marked this pull request as ready for review March 2, 2026 15:10
Copilot AI review requested due to automatic review settings March 2, 2026 15:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes dead code in the Go parser to fix golangci-lint (unused) failures caused by the now-unreferenced buildCanonicalFrontmatter helper.

Changes:

  • Deleted the unused buildCanonicalFrontmatter function from pkg/parser/frontmatter_hash.go after the refactor to the text-based hashing path.

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

@pelikhan pelikhan merged commit 38cf6da into main Mar 2, 2026
109 checks passed
@pelikhan pelikhan deleted the copilot/remove-dead-function-lint branch March 2, 2026 15:12
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.

[CI Failure Doctor] CI Failure Investigation - Run #38509

3 participants