Skip to content

Commit

Permalink
Revert "add flag.Parse so HandlFlags works correctly (#14214)" (#14292)
Browse files Browse the repository at this point in the history
This reverts commit 7efa6d5.

Require beats bump / revert #14310 (8.x: #14309 )
Part of #14280

(cherry picked from commit 01237c4)
  • Loading branch information
carsonip authored and mergify[bot] committed Oct 9, 2024
1 parent dd3cbe4 commit 8247106
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion cmd/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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: 1 addition & 3 deletions internal/beatcmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package beatcmd

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

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

flag.Parse()
if err := cfgfile.HandleFlags(); err != nil {
log.Fatal(err)
}
Expand Down
1 change: 0 additions & 1 deletion x-pack/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ 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: 0 additions & 1 deletion x-pack/apm-server/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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 8247106

Please sign in to comment.