Skip to content

Commit

Permalink
Remove duplicated type and function from flare comp (#30851)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgimalac authored Nov 7, 2024
1 parent 8ab1984 commit a2867c0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 58 deletions.
21 changes: 0 additions & 21 deletions comp/core/flare/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
// is not built in the binary.
package flarebuilder

import (
compdef "github.com/DataDog/datadog-agent/comp/def"
)

// FlareBuilder contains all the helpers to add files to a flare archive.
//
// When adding data to a flare the builder will do multiple things internally.
Expand Down Expand Up @@ -146,20 +142,3 @@ type FlareBuilder interface {
// components.
Save() (string, error)
}

// FlareCallback is a function that can be registered as a data provider for flares. This function, if registered, will
// be called everytime a flare is created.
type FlareCallback func(fb FlareBuilder) error

// Provider is provided by other components to register themselves to provide flare data.
type Provider struct {
compdef.Out
Callback FlareCallback `group:"flare"`
}

// NewProvider returns a new Provider to be called when a flare is created
func NewProvider(callback FlareCallback) Provider {
return Provider{
Callback: callback,
}
}
11 changes: 0 additions & 11 deletions comp/core/flare/builder/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
module github.com/DataDog/datadog-agent/comp/core/flare/builder

go 1.22.0

replace github.com/DataDog/datadog-agent/comp/def => ../../../def

require github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 0 additions & 10 deletions comp/core/flare/builder/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions comp/core/flare/types/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ module github.com/DataDog/datadog-agent/comp/core/flare/types

go 1.22.0

replace (
github.com/DataDog/datadog-agent/comp/core/flare/builder => ../builder
github.com/DataDog/datadog-agent/comp/def => ../../../def
)
replace github.com/DataDog/datadog-agent/comp/core/flare/builder => ../builder

require (
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3
go.uber.org/fx v1.22.2
)

require (
github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
go.uber.org/dig v1.18.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/sys v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
2 changes: 0 additions & 2 deletions comp/core/flare/types/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions comp/core/flare/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@
package types

import (
flarebuilder "github.com/DataDog/datadog-agent/comp/core/flare/builder"
"go.uber.org/fx"

flarebuilder "github.com/DataDog/datadog-agent/comp/core/flare/builder"
)

// FlareBuilder contains all the helpers to add files to a flare archive.
// see the aliased type for the full description
type FlareBuilder = flarebuilder.FlareBuilder

// FlareCallback is called by the FlareBuilder to build the flare
// see the aliased type for the full description
type FlareCallback = flarebuilder.FlareCallback
// FlareCallback is a function that can be registered as a data provider for flares. This function, if registered, will
// be called everytime a flare is created.
type FlareCallback func(fb FlareBuilder) error

// Provider is provided by other components to register themselves to provide flare data.
type Provider struct {
fx.Out
Callback flarebuilder.FlareCallback `group:"flare"`
Callback FlareCallback `group:"flare"`
}

// NewProvider returns a new Provider to be called when a flare is created
func NewProvider(callback flarebuilder.FlareCallback) Provider {
func NewProvider(callback FlareCallback) Provider {
return Provider{
Callback: callback,
}
Expand Down

0 comments on commit a2867c0

Please sign in to comment.