Skip to content

Commit

Permalink
Bugfix: i18n is initialized too late
Browse files Browse the repository at this point in the history
See related issue: ubuntu/adsys#656
  • Loading branch information
EduardGomezEscandell committed Mar 29, 2023
1 parent 652e491 commit e14ebef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion windows-agent/cmd/ubuntu-pro-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
//go:generate go run ../generate_completion_documentation.go update-doc-cli-ref

func main() {
i18n.InitI18nDomain(common.TEXTDOMAIN)
a := agent.New()
os.Exit(run(a))
}
Expand All @@ -30,7 +31,6 @@ type app interface {
}

func run(a app) int {
i18n.InitI18nDomain(common.TEXTDOMAIN)
defer installSignalHandler(a)()

log.SetFormatter(&log.TextFormatter{
Expand Down
4 changes: 4 additions & 0 deletions windows-agent/cmd/ubuntu-pro-agent/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (a *myApp) Quit() {
}

func TestRun(t *testing.T) {
t.Parallel()

tests := map[string]struct {
runError bool
usageErrorReturn bool
Expand All @@ -46,6 +48,8 @@ func TestRun(t *testing.T) {
for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

a := myApp{
done: make(chan struct{}),
runError: tc.runError,
Expand Down
2 changes: 1 addition & 1 deletion wsl-pro-service/cmd/wsl-pro-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
//go:generate go run ../generate_completion_documentation.go update-doc-cli-ref

func main() {
i18n.InitI18nDomain(common.TEXTDOMAIN)
a := service.New()
os.Exit(run(a))
}
Expand All @@ -30,7 +31,6 @@ type app interface {
}

func run(a app) int {
i18n.InitI18nDomain(common.TEXTDOMAIN)
defer installSignalHandler(a)()

log.SetFormatter(&log.TextFormatter{
Expand Down
4 changes: 4 additions & 0 deletions wsl-pro-service/cmd/wsl-pro-service/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func TestRunSignal(t *testing.T) {
}

func TestRun(t *testing.T) {
t.Parallel()

tests := map[string]struct {
runError bool
usageErrorReturn bool
Expand All @@ -78,6 +80,8 @@ func TestRun(t *testing.T) {
for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

a := myApp{
done: make(chan struct{}),
runError: tc.runError,
Expand Down

0 comments on commit e14ebef

Please sign in to comment.