Skip to content

Commit 76b1f5f

Browse files
committed
Maint: local scoped buildInfo
1 parent c5de135 commit 76b1f5f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cmd/updater/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ import (
3434

3535
//nolint:gochecknoglobals
3636
var (
37-
buildInfo models.BuildInformation
3837
version = "unknown"
3938
commit = "unknown"
4039
buildDate = "an unknown date"
4140
)
4241

4342
func main() {
44-
buildInfo.Version = version
45-
buildInfo.Commit = commit
46-
buildInfo.BuildDate = buildDate
43+
buildInfo := models.BuildInformation{
44+
Version: version,
45+
Commit: commit,
46+
BuildDate: buildDate,
47+
}
4748
env := params.NewEnv()
4849
logger := logging.NewParent(logging.Settings{Writer: os.Stdout})
4950

@@ -53,7 +54,7 @@ func main() {
5354

5455
errorCh := make(chan error)
5556
go func() {
56-
errorCh <- _main(ctx, env, os.Args, logger, time.Now)
57+
errorCh <- _main(ctx, env, os.Args, logger, buildInfo, time.Now)
5758
}()
5859

5960
select {
@@ -89,7 +90,7 @@ func main() {
8990
}
9091

9192
func _main(ctx context.Context, env params.Env, args []string, logger logging.ParentLogger,
92-
timeNow func() time.Time) (err error) {
93+
buildInfo models.BuildInformation, timeNow func() time.Time) (err error) {
9394
if health.IsClientMode(args) {
9495
// Running the program in a separate instance through the Docker
9596
// built-in healthcheck, in an ephemeral fashion to query the

0 commit comments

Comments
 (0)