Skip to content

Commit 7efa6d5

Browse files
leehinmankruskalldependabot[bot]v1vgithub-actions[bot]
authored
add flag.Parse so HandlFlags works correctly (#14214)
* add flag.Parse so HandlFlags works correctly * fix: move flag init outside package initialization Since go 1.13 testing flags are now only registered when running a test binary, and packages that call flag.Parse during package initialization may cause tests to fail. To resolve this move the flag init to a proper function outside of package init and call it explicitly * build(deps): bump the dependencies group in /systemtest with 2 updates (#14213) Bumps the dependencies group in /systemtest with 2 updates: [go.opentelemetry.io/collector/pdata](https://github.com/open-telemetry/opentelemetry-collector) and [go.opentelemetry.io/collector/semconv](https://github.com/open-telemetry/opentelemetry-collector). Updates `go.opentelemetry.io/collector/pdata` from 1.15.0 to 1.16.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md) - [Commits](open-telemetry/opentelemetry-collector@pdata/v1.15.0...pdata/v1.16.0) Updates `go.opentelemetry.io/collector/semconv` from 0.109.0 to 0.110.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md) - [Commits](open-telemetry/opentelemetry-collector@v0.109.0...v0.110.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector/pdata dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: go.opentelemetry.io/collector/semconv dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump go.elastic.co/go-licence-detector (#14212) Bumps the dependencies group in /tools with 1 update: [go.elastic.co/go-licence-detector](https://github.com/elastic/go-licence-detector). Updates `go.elastic.co/go-licence-detector` from 0.6.1 to 0.7.0 - [Release notes](https://github.com/elastic/go-licence-detector/releases) - [Commits](elastic/go-licence-detector@v0.6.1...v0.7.0) --- updated-dependencies: - dependency-name: go.elastic.co/go-licence-detector dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kruskall <[email protected]> * ci: use ephemeral tokens (#14217) * build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.11.2 to 0.11.3 (#14211) * build(deps): bump github.com/elastic/elastic-agent-system-metrics Bumps [github.com/elastic/elastic-agent-system-metrics](https://github.com/elastic/elastic-agent-system-metrics) from 0.11.2 to 0.11.3. - [Release notes](https://github.com/elastic/elastic-agent-system-metrics/releases) - [Commits](elastic/elastic-agent-system-metrics@v0.11.2...v0.11.3) --- updated-dependencies: - dependency-name: github.com/elastic/elastic-agent-system-metrics dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Update NOTICE.txt --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: kruskall <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: kruskal <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Victor Martinez <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent cf9bd05 commit 7efa6d5

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

cmd/apm-server/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
)
2626

2727
func main() {
28+
beatcmd.InitBeatCmd()
2829
rootCmd := beatcmd.NewRootCommand(beatcmd.BeatParams{
2930
NewRunner: func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
3031
return beater.NewRunner(beater.RunnerParams{

internal/beatcmd/init.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package beatcmd
1919

2020
import (
2121
cryptorand "crypto/rand"
22+
"flag"
2223
"log"
2324
"math"
2425
"math/big"
@@ -38,7 +39,7 @@ import (
3839
_ "github.com/elastic/beats/v7/libbeat/publisher/queue/memqueue"
3940
)
4041

41-
func init() {
42+
func InitBeatCmd() {
4243
initRand()
4344
initFlags()
4445
}
@@ -62,6 +63,7 @@ func initFlags() {
6263
}
6364
}
6465

66+
flag.Parse()
6567
if err := cfgfile.HandleFlags(); err != nil {
6668
log.Fatal(err)
6769
}

x-pack/apm-server/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ func cleanup() error {
275275
}
276276

277277
func Main() error {
278+
beatcmd.InitBeatCmd()
278279
rootCmd := newXPackRootCommand(
279280
func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
280281
return beater.NewRunner(beater.RunnerParams{

x-pack/apm-server/root_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
)
1414

1515
func TestSubCommands(t *testing.T) {
16+
beatcmd.InitBeatCmd()
1617
rootCmd := newXPackRootCommand(func(beatcmd.RunnerParams) (beatcmd.Runner, error) {
1718
panic("unexpected call")
1819
})

0 commit comments

Comments
 (0)