Skip to content

Commit

Permalink
Merge branch 'main' into inject-build-pgo-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
1pkg committed Oct 1, 2024
2 parents 68d921e + 7efa6d5 commit a716e64
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
)

func main() {
beatcmd.InitBeatCmd()
rootCmd := beatcmd.NewRootCommand(beatcmd.BeatParams{
NewRunner: func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
return beater.NewRunner(beater.RunnerParams{
Expand Down
4 changes: 3 additions & 1 deletion internal/beatcmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package beatcmd

import (
cryptorand "crypto/rand"
"flag"
"log"
"math"
"math/big"
Expand All @@ -38,7 +39,7 @@ import (
_ "github.com/elastic/beats/v7/libbeat/publisher/queue/memqueue"
)

func init() {
func InitBeatCmd() {
initRand()
initFlags()
}
Expand All @@ -62,6 +63,7 @@ func initFlags() {
}
}

flag.Parse()
if err := cfgfile.HandleFlags(); err != nil {
log.Fatal(err)
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ func cleanup() error {
}

func Main() error {
beatcmd.InitBeatCmd()
rootCmd := newXPackRootCommand(
func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
return beater.NewRunner(beater.RunnerParams{
Expand Down
1 change: 1 addition & 0 deletions x-pack/apm-server/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestSubCommands(t *testing.T) {
beatcmd.InitBeatCmd()
rootCmd := newXPackRootCommand(func(beatcmd.RunnerParams) (beatcmd.Runner, error) {
panic("unexpected call")
})
Expand Down

0 comments on commit a716e64

Please sign in to comment.