Skip to content

Implement check-depends --help and refactor help texts for easier maintenance#306

Open
ottok wants to merge 4 commits intoDebian:masterfrom
ottok:fix-help-flags
Open

Implement check-depends --help and refactor help texts for easier maintenance#306
ottok wants to merge 4 commits intoDebian:masterfrom
ottok:fix-help-flags

Conversation

@ottok
Copy link
Contributor

@ottok ottok commented Feb 27, 2026

See commits for details.

User visible result:

dh-make-golang check-depends --help
Usage: debian/dh-make-golang/usr/bin/dh-make-golang check-depends

Compares the Go module dependencies in go.mod against
the Debian packages available in the archive.

Reports:
  NEW: Dependencies in go.mod not yet packaged in Debian
  RM:  Debian packages in d/control no longer needed by go.mod

This command takes no arguments.

According to `dh-make-golang`, all commands should emit help when called
with `--help`. It was missing for `check-depends`, so implement it now.

Add a proper flag.FlagSet with usage text explaining that check-depends
compares go.mod dependencies against Debian packages and reports which
ones are missing or obsolete. Also reject any positional arguments to
keep the interface simple and predictable.
The scattered `fmt.Fprintf(os.Stderr, ...)` calls made the help texts
hard to read and maintain.  Switch to Go raw string literals (` `)
so the entire block is formatted exactly as it will appear to the
user.

No functional changes. The help text is still the same.
Verify that the CLI help flag works correctly and displays the expected
usage information. This catches regressions where the command-line
interface might break or the help text becomes malformed.
This silences the unnecessary git hint visible when running `go test`:

    === RUN   TestSnapshotVersion
    hint: Using 'master' as the name for the initial branch. This default branch name
    hint: is subject to change. To configure the initial branch name to use in all
    hint: of your new repositories, which will suppress this warning, call:
    hint:
    hint: 	git config --global init.defaultBranch <name>
    hint:
    hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
    hint: 'development'. The just-created branch can be renamed via this command:
    hint:
    hint: 	git branch -m <name>
    hint:
    hint: Disable this message with "git config set advice.defaultBranchName false"
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.

1 participant