lint: require name on interface parameters

This commit is contained in:
marco 2025-05-09 09:42:52 +02:00
parent 341e816a5c
commit a816e27ac6
4 changed files with 7 additions and 8 deletions

View file

@ -30,7 +30,6 @@ linters:
- exhaustive # check exhaustiveness of enum switch statements
- godot # Check if comments end in a period
- gosec # (gas): Inspects source code for security problems
- inamedparam # reports interfaces with unnamed method parameters
- musttag # enforce field tags in (un)marshaled structs
- promlinter # Check Prometheus metrics naming via promlint
- protogetter # Reports direct reads from proto message fields when getters should be used

View file

@ -43,13 +43,13 @@ func (e *DataSourceUnavailableError) Unwrap() error {
type DataSource interface {
GetMetrics() []prometheus.Collector // Returns pointers to metrics that are managed by the module
GetAggregMetrics() []prometheus.Collector // Returns pointers to metrics that are managed by the module (aggregated mode, limits cardinality)
UnmarshalConfig([]byte) error // Decode and pre-validate the YAML datasource - anything that can be checked before runtime
Configure([]byte, *log.Entry, int) error // Complete the YAML datasource configuration and perform runtime checks.
ConfigureByDSN(string, map[string]string, *log.Entry, string) error // Configure the datasource
UnmarshalConfig(yamlConfig []byte) error // Decode and pre-validate the YAML datasource - anything that can be checked before runtime
Configure(yamlConfig []byte, logger *log.Entry, metricsLevel int) error // Complete the YAML datasource configuration and perform runtime checks.
ConfigureByDSN(dsn string, labels map[string]string, logger *log.Entry, uniqueID string) error // Configure the datasource
GetMode() string // Get the mode (TAIL, CAT or SERVER)
GetName() string // Get the name of the module
OneShotAcquisition(context.Context, chan types.Event, *tomb.Tomb) error // Start one shot acquisition(eg, cat a file)
StreamingAcquisition(context.Context, chan types.Event, *tomb.Tomb) error // Start live acquisition (eg, tail a file)
OneShotAcquisition(ctx context.Context, out chan types.Event, acquisTomb *tomb.Tomb) error // Start one shot acquisition(eg, cat a file)
StreamingAcquisition(ctx context.Context, out chan types.Event, acquisTomb *tomb.Tomb) error // Start live acquisition (eg, tail a file)
CanRun() error // Whether the datasource can run or not (eg, journalctl on BSD is a non-sense)
GetUuid() string // Get the unique identifier of the datasource
Dump() interface{}

View file

@ -12,7 +12,7 @@ import (
type rawBodyProcessor struct{}
type setterInterface interface {
Set(string)
Set(value string)
}
func (*rawBodyProcessor) ProcessRequest(reader io.Reader, v plugintypes.TransactionVariables, options plugintypes.BodyProcessorOptions) error {

View file

@ -29,7 +29,7 @@ type Command interface {
// an error if the preparation failed.
// NOTE: Returning an error will bubble up from the plan.AddCommand() method,
// but Prepare() might already have modified the plan's command slice.
Prepare(*ActionPlan) (bool, error)
Prepare(plan *ActionPlan) (bool, error)
// Run executes the command within the provided context and ActionPlan.
// It performs the actual operation and returns an error if execution fails.