Skip to content

[Tech Debt]: Dead code — BindFlags() in config.go is never called outside tests #103

Description

@mrhillsman

Category

Code quality / code smell

Description

BindFlags() in internal/config/config.go:75 registers Cobra flags on a command, but it is never called from production code. The CLI flags are registered directly in cmd/virtwork/main.go via newRunCmd() and newCleanupCmd(). The only caller of BindFlags() is in config_test.go:28.

This creates two problems:

  1. Flag definitions are duplicated — main.go and config.go define overlapping flags independently, so they can drift out of sync
  2. BindFlags() gives a false impression that flag registration is centralized when it is not actually used

Severity

Low — cosmetic or minor inconvenience

Affected Files

  • internal/config/config.go:74-92BindFlags() defined but never called from production code
  • cmd/virtwork/main.go:54-91 — flags registered directly, duplicating what BindFlags does
  • internal/config/config_test.go:28 — only caller of BindFlags()

Proposed Fix

Either:

  1. Remove BindFlags() and update the test to register flags inline, or
  2. Use BindFlags() from main.go to centralize flag registration and eliminate the duplication

Option 2 is preferred as it eliminates the flag definition drift risk.

Area

CLI / Configuration

Architecture Layer

Layer 1 - Infrastructure (config, cluster, cloudinit, audit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt, code quality, or maintenance concern

    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