Skip to content

fix: pullgate --version fails with "flag provided but not defined" #14

Closed

Description

@groupsky

Problem

pullgate --version fails in v0.1.0:

$ pullgate --version
pullgate: flag provided but not defined: -version; see "pullgate --help" (exit 64)

Only the version command works (pullgate version prints pullgate 0.1.0). Most tools take --version, so people and scripts try it first. Found on 2026-11-16, in the first real run of install.sh against v0.1.0 (#7).

cmd/pullgate/main.go defines its global flags with flag.NewFlagSet; --version is not one of them.

Proposal

  • pullgate --version and pullgate -version print the same line as pullgate version and exit 0, also with other global flags before them.
  • --help and the README name both forms.
  • install.sh keeps calling the version command (it works with every release), so nothing changes there.

Done when

  • pullgate --version prints pullgate X.Y.Z on stdout and exits 0; a test covers it.
  • pullgate --config-dir /x --version does the same.
  • pullgate version still works as before; a test covers it.
  • pullgate --help lists --version.
  • The fix is in a released version (fix: commit, so release-please makes a patch release).

Activity

  1. added a commit that references this issue on Nov 16, 2026
    7ccac79
  2. groupsky commented on Nov 16, 2026

    @groupsky
    ContributorAuthor

    Fixed in #15 (squash commit 5450bbc). Evidence for each box:

    • pullgate --version prints pullgate X.Y.Z on stdout and exits 0. TestVersionForms in cmd/pullgate/main_test.go runs --version and -version with the version set to 1.2.3 and checks: exit 0, stdout exactly pullgate 1.2.3\n, empty stderr.
    • pullgate --config-dir /x --version does the same. The same test runs --config-dir /x --version and --config-dir=/x --state-dir /y --spool-dir /z -version. The flag returns before any config is read.
    • pullgate version still works. TestVersionForms runs version too. install.sh still uses it.
    • pullgate --help lists --version. TestHelpListsVersion checks --help and -h. The README names both forms.
    • In a released version. Release PR chore(main): release 0.1.1 #18 (chore(main): release 0.1.1) waits for the owner's OK.

    Deny paths (TestVersionDeny): --version=maybe, --versions, --config-dir --version (no command), --version=false, and --version after run, status or listen all exit 64 with no stdout.

    CI was red on main for a reason outside this change (the runner's newer systemd warns about its own units). #16 fixed that first. A flaky e2e wait seen on main is #17.

  3. groupsky commented on Nov 16, 2026

    @groupsky
    ContributorAuthor

    Released in v0.1.1 (release PR #18, squash commit 8cd9c09, the Release workflow passed): https://github.com/code6x/pullgate/releases/tag/v0.1.1

    • In a released version. Check on 2026-11-16, in a throwaway container (docker run --rm debian:stable-slim, with curl and ca-certificates): install.sh from the tag v0.1.1 (SHA-256 a6ebc029b65f72f0251f496850f5af8ba77aae00ef5daf6a4882656598ca57e6), run as root with --version 0.1.1:
    Asking GitHub for the release v0.1.1 of pullgate.
    Installing pullgate 0.1.1 as /usr/local/bin/pullgate.
    Downloading pullgate_0.1.1_linux_amd64.tar.gz, SHA256SUMS and pullgate_0.1.1.sigstore.json.
    Downloading gh 2.102.0 to check the attestation.
    Checking the build attestation of pullgate_0.1.1_linux_amd64.tar.gz with gh 2.102.0.
    The attestation is valid: the release workflow of code6x/pullgate on main built this file.
    Done. /usr/local/bin/pullgate version says: pullgate 0.1.1
    install exit: 0
    --- /usr/local/bin/pullgate --version:
    pullgate 0.1.1
    exit: 0
    

    All boxes are met, so I close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowDo when nothing else waits

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions