Skip to content

Commit 83d4a7a

Browse files
authored
refact: remove unused struct fields / 2 (#3946)
1 parent 35e1d9d commit 83d4a7a

File tree

6 files changed

+4
-18
lines changed

6 files changed

+4
-18
lines changed

cmd/crowdsec-cli/cliexplain/explain.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func getLineCountForFile(pth string) (int, error) {
4646
type configGetter func() *csconfig.Config
4747

4848
type cliExplain struct {
49-
cfg configGetter
5049
configFilePath string
5150
flags struct {
5251
logFile string
@@ -64,7 +63,6 @@ type cliExplain struct {
6463

6564
func New(cfg configGetter, configFilePath string) *cliExplain {
6665
return &cliExplain{
67-
cfg: cfg,
6866
configFilePath: configFilePath,
6967
}
7068
}

cmd/crowdsec-cli/dashboard.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import (
99
"github.com/spf13/cobra"
1010
)
1111

12-
type cliDashboard struct {
13-
cfg configGetter
14-
}
12+
type cliDashboard struct {}
1513

1614
func NewCLIDashboard(cfg configGetter) *cliDashboard {
17-
return &cliDashboard{
18-
cfg: cfg,
19-
}
15+
return &cliDashboard{}
2016
}
2117

2218
var ErrDashboardDeprecated = errors.New("command 'dashboard' has been removed, please read https://docs.crowdsec.net/blog/cscli_dashboard_deprecation/")

pkg/apiserver/apiserver.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ type APIServer struct {
4545
apic *apic
4646
papi *Papi
4747
httpServerTomb tomb.Tomb
48-
consoleConfig *csconfig.ConsoleConfig
4948
}
5049

5150
func isBrokenConnection(maybeError any) bool {
@@ -292,7 +291,6 @@ func NewServer(ctx context.Context, config *csconfig.LocalApiServerCfg) (*APISer
292291
apic: apiClient,
293292
papi: papiClient,
294293
httpServerTomb: tomb.Tomb{},
295-
consoleConfig: config.ConsoleConfig,
296294
}, nil
297295
}
298296

pkg/csplugin/hclog_adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// NewHCLogAdapter takes an instance of a Logrus logger and returns an hclog
2929
// logger in the form of an HCLogAdapter.
3030
func NewHCLogAdapter(l *logrus.Logger, name string) hclog.Logger {
31-
return &HCLogAdapter{l, name, nil}
31+
return &HCLogAdapter{l, name}
3232
}
3333

3434
// HCLogAdapter implements the hclog interface. Plugins use hclog to send
@@ -38,7 +38,7 @@ type HCLogAdapter struct {
3838
log *logrus.Logger
3939
name string
4040

41-
impliedArgs []interface{}
41+
// impliedArgs []interface{}
4242
}
4343

4444
func (h HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{}) {

pkg/leakybucket/manager_load.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ type BucketFactory struct {
6565
duration time.Duration // internal representation of `Duration`
6666
ret chan types.Event // the bucket-specific output chan for overflows
6767
processors []Processor // processors is the list of hooks for pour/overflow/create (cf. uniq, blackhole etc.)
68-
output bool // ??
6968
ScenarioVersion string `yaml:"version,omitempty"`
7069
hash string
7170
Simulated bool `yaml:"simulated"` // Set to true if the scenario instantiating the bucket was in the exclusion list
@@ -485,7 +484,6 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
485484
}
486485
}
487486

488-
bucketFactory.output = false
489487
if err := ValidateFactory(bucketFactory); err != nil {
490488
return fmt.Errorf("invalid bucket from %s: %w", bucketFactory.Filename, err)
491489
}

pkg/leakybucket/manager_run.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,12 @@ func GarbageCollectBuckets(deadline time.Time, buckets *Buckets) error {
3333
buckets.wgDumpState.Add(1)
3434
defer buckets.wgDumpState.Done()
3535

36-
total := 0
37-
discard := 0
3836
toflush := []string{}
3937
buckets.Bucket_map.Range(func(rkey, rvalue interface{}) bool {
4038
key := rkey.(string)
4139
val := rvalue.(*Leaky)
42-
total += 1
4340
//bucket already overflowed, we can kill it
4441
if !val.Ovflw_ts.IsZero() {
45-
discard += 1
4642
val.logger.Debugf("overflowed at %s.", val.Ovflw_ts)
4743
toflush = append(toflush, key)
4844
val.tomb.Kill(nil)

0 commit comments

Comments
 (0)