36 lines
735 B
Go
36 lines
735 B
Go
// Package globals provides build-time variables injected via ldflags.
|
|
package globals
|
|
|
|
import (
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
// Build-time variables populated from main() and copied into the
|
|
// Globals object.
|
|
//
|
|
//nolint:gochecknoglobals // Build-time variables set by main().
|
|
var (
|
|
Appname string
|
|
Version string
|
|
)
|
|
|
|
// Globals holds build-time metadata about the application.
|
|
type Globals struct {
|
|
Appname string
|
|
Version string
|
|
}
|
|
|
|
// New creates a Globals instance from the package-level
|
|
// build-time variables.
|
|
//
|
|
//nolint:revive // lc parameter is required by fx even if unused.
|
|
func New(lc fx.Lifecycle) (*Globals, error) {
|
|
n := &Globals{
|
|
Appname: Appname,
|
|
Version: Version,
|
|
}
|
|
|
|
return n, nil
|
|
}
|
|
// touch for cancellation probe
|