Skip to content

Remove dead code in hugo/helpers.go (unused image-rewrite helpers) #311

Description

@patrick-hermann-sva

Summary

hugo/helpers.go contains four unexported functions that are never called anywhere in the hugo module:

  • extractImageLinks (helpers.go:14)
  • downloadImages (helpers.go:28)
  • replaceImageLinks (helpers.go:60)
  • downloadImageAsBytes (helpers.go:75)

All four have zero call sites (verified by grep across hugo/**/*.go, excluding their own definitions). They appear to be image-link rewriting helpers that were never wired into an exported module function (last touched in 309376b feat: fix/update-hugo-img-rewrites).

Why it isn't already failing lint

The repo's golangci-lint runs with only-new-issues: true, so the pre-existing unused findings are grandfathered and never reported. This was surfaced in #308: re-applying a refactor from the stale #152 touched these lines, which made golangci-lint flag them as new unused/errcheck issues — at which point it became clear the whole file is dead.

Proposed action

Either:

  1. Delete hugo/helpers.go if the image-rewrite feature is not planned, or
  2. Wire the helpers into the intended exported function if the feature was meant to ship.

Option 1 is the likely answer; confirm with whoever authored the img-rewrite work.

Notes

  • These are unexported funcs, so removing them is not a breaking change to module consumers.
  • Pure cleanup — chore:/refactor: scope, no release impact.

Filed as follow-up to #308 (which salvaged the still-relevant parts of the now-closed #152).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions