Consolidate appname to internal/globals as a constant #34

Merged
sneak merged 2 commits from consolidate-appname-to-globals into main 2026-03-20 07:04:54 +01:00
Collaborator

Closes issue #30.

The appname "pixad" was redundantly defined in both cmd/pixad/main.go (as a package-level var) and internal/globals/globals.go (as a package-level var that got copied from main). Since the appname is always "pixad" and is not actually set via ldflags (only Version is), this PR:

  • Defines appname once as an unexported constant in internal/globals/globals.go
  • Removes the Appname var from cmd/pixad/main.go
  • Removes the globals.Appname = Appname assignment from main.run()
  • Keeps Version flow unchanged (still set via ldflags in main, passed to globals)

The Globals.Appname struct field remains available to all consumers — they just get it from the constant now instead of a package var that was always "pixad".

All existing tests pass, docker build . succeeds.

Closes [issue #30](https://git.eeqj.de/sneak/pixa/issues/30). The appname `"pixad"` was redundantly defined in both `cmd/pixad/main.go` (as a package-level var) and `internal/globals/globals.go` (as a package-level var that got copied from main). Since the appname is always `"pixad"` and is not actually set via ldflags (only `Version` is), this PR: - Defines `appname` once as an unexported constant in `internal/globals/globals.go` - Removes the `Appname` var from `cmd/pixad/main.go` - Removes the `globals.Appname = Appname` assignment from `main.run()` - Keeps `Version` flow unchanged (still set via ldflags in main, passed to globals) The `Globals.Appname` struct field remains available to all consumers — they just get it from the constant now instead of a package var that was always `"pixad"`. All existing tests pass, `docker build .` succeeds.
clawbot added 1 commit 2026-03-17 09:53:34 +01:00
consolidate appname to internal/globals as a constant
All checks were successful
check / check (push) Successful in 1m47s
cf825a7260
The appname was redundantly defined in both cmd/pixad/main.go and
internal/globals/globals.go. Since it is always "pixad" and is not
actually set via ldflags (only Version is), define it once as an
unexported constant in globals.go and remove it from main.go.
clawbot added the needs-review label 2026-03-17 09:58:34 +01:00
Author
Collaborator

Review: PR #34 — Consolidate appname to internal/globals as a constant

Policy Compliance

  • No modifications to .golangci.yml, Makefile, Dockerfile, CI config, or test assertions
  • Only 2 files changed (cmd/pixad/main.go, internal/globals/globals.go) — tightly scoped
  • Single commit with clear message
  • No secrets, PII, or credentials in diff
  • go.mod/go.sum unchanged (no dependency changes)
  • External references unchanged (Docker image hashes intact)
  • README does not reference appname internals — no update needed

Requirements Checklist (issue #30)

Issue: "Appname doesn't need to be in main and internal/globals both"

  • Appname var removed from cmd/pixad/main.go
  • globals.Appname = Appname assignment removed from main.run()
  • appname defined once as an unexported constant in internal/globals/globals.go
  • Globals.Appname struct field still populated correctly (from the constant)
  • All 5 consumers of globals.Appname (logger, config, healthcheck, server/sentry) continue to work unchanged via the Globals struct
  • Version ldflags flow completely unchanged (Makefile: -X main.Version, Dockerfile: -X main.Version=${VERSION})
  • No unaddressed human comments on PR or issue

Build Result

docker build .PASS (fmt-check , lint , all tests , binary build )

Rebase

Branch consolidate-appname-to-globals is already up to date with main.

Verdict: PASS

Clean, minimal change that does exactly what the issue asks — eliminates the redundant Appname variable in main by making it a constant in globals. No behavioral change, no scope creep.

## Review: PR #34 — Consolidate appname to internal/globals as a constant ### Policy Compliance - ✅ No modifications to `.golangci.yml`, `Makefile`, `Dockerfile`, CI config, or test assertions - ✅ Only 2 files changed (`cmd/pixad/main.go`, `internal/globals/globals.go`) — tightly scoped - ✅ Single commit with clear message - ✅ No secrets, PII, or credentials in diff - ✅ `go.mod`/`go.sum` unchanged (no dependency changes) - ✅ External references unchanged (Docker image hashes intact) - ✅ README does not reference appname internals — no update needed ### Requirements Checklist ([issue #30](https://git.eeqj.de/sneak/pixa/issues/30)) Issue: "Appname doesn't need to be in main and internal/globals both" - ✅ `Appname` var removed from `cmd/pixad/main.go` - ✅ `globals.Appname = Appname` assignment removed from `main.run()` - ✅ `appname` defined once as an unexported constant in `internal/globals/globals.go` - ✅ `Globals.Appname` struct field still populated correctly (from the constant) - ✅ All 5 consumers of `globals.Appname` (logger, config, healthcheck, server/sentry) continue to work unchanged via the `Globals` struct - ✅ `Version` ldflags flow completely unchanged (Makefile: `-X main.Version`, Dockerfile: `-X main.Version=${VERSION}`) - ✅ No unaddressed human comments on PR or issue ### Build Result `docker build .` — **PASS** (fmt-check ✅, lint ✅, all tests ✅, binary build ✅) ### Rebase Branch `consolidate-appname-to-globals` is already up to date with `main`. ### Verdict: **PASS** Clean, minimal change that does exactly what the issue asks — eliminates the redundant `Appname` variable in main by making it a constant in globals. No behavioral change, no scope creep.
clawbot added merge-ready and removed needs-review labels 2026-03-17 10:18:31 +01:00
sneak was assigned by clawbot 2026-03-17 10:18:32 +01:00
sneak added 1 commit 2026-03-18 03:45:51 +01:00
Merge branch 'main' into consolidate-appname-to-globals
All checks were successful
check / check (push) Successful in 1m5s
9cde18549e
sneak merged commit e85b5ff033 into main 2026-03-20 07:04:54 +01:00
sneak deleted branch consolidate-appname-to-globals 2026-03-20 07:04:54 +01:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#34