All checks were successful
check / check (push) Successful in 1m48s
Closes [issue #30](#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. Co-authored-by: user <user@Mac.lan guest wan> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #34 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
26 lines
538 B
Go
26 lines
538 B
Go
// Package globals provides application-wide constants set at build time.
|
|
package globals
|
|
|
|
import (
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
const appname = "pixad"
|
|
|
|
// Version is populated from main() via ldflags.
|
|
var Version string //nolint:gochecknoglobals // set from main
|
|
|
|
// Globals holds application-wide constants.
|
|
type Globals struct {
|
|
Appname string
|
|
Version string
|
|
}
|
|
|
|
// New creates a new Globals instance from build-time variables.
|
|
func New(_ fx.Lifecycle) (*Globals, error) {
|
|
return &Globals{
|
|
Appname: appname,
|
|
Version: Version,
|
|
}, nil
|
|
}
|