diff options
| author | copilot-swe-agent[bot] <[email protected]> | 2026-04-28 18:24:00 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-28 18:24:00 +0000 |
| commit | 8834c0be63ee88e0ad23fe621d5f5fe344b32089 (patch) | |
| tree | 49029d2fd927e8832d05420d1bf1cf850aa22325 /plugin/special/test.go | |
| parent | 4f125e579472e5ed87fd052ef68ab80f5fe679b0 (diff) | |
Refactor all plugins to use functional options patterncopilot/refactor-plugins-functional-options
Agent-Logs-Url: https://github.com/Loyalsoldier/geoip/sessions/e2b66c9a-3d01-490c-9b31-32109cfe4feb
Co-authored-by: Loyalsoldier <[email protected]>
Diffstat (limited to 'plugin/special/test.go')
| -rw-r--r-- | plugin/special/test.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/plugin/special/test.go b/plugin/special/test.go index cf83ed83..6425ca93 100644 --- a/plugin/special/test.go +++ b/plugin/special/test.go @@ -18,19 +18,31 @@ var testCIDRs = []string{ func init() { lib.RegisterInputConfigCreator(typeTest, func(action lib.Action, data json.RawMessage) (lib.InputConverter, error) { - return newTest(action, data) + return NewTestFromBytes(action, data) }) lib.RegisterInputConverter(typeTest, &test{ Description: descTest, }) } -func newTest(action lib.Action, data json.RawMessage) (lib.InputConverter, error) { - return &test{ +func NewTest(action lib.Action, opts ...lib.InputOption) lib.InputConverter { + t := &test{ Type: typeTest, Action: action, Description: descTest, - }, nil + } + + for _, opt := range opts { + if opt != nil { + opt(t) + } + } + + return t +} + +func NewTestFromBytes(action lib.Action, data []byte) (lib.InputConverter, error) { + return NewTest(action), nil } type test struct { |
