Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Revert "add flag.Parse so HandlFlags works correctly (#14214)" (backport #14292) #14314

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading