Skip to content

Commit

Permalink
all: remove unused fields
Browse files Browse the repository at this point in the history
Remove (some) unused fields detected via:
```
$ go install honnef.co/go/tools/internal/cmd/unused@latest
$ unused -field-writes-are-uses=false ./... 2>/dev/null
```

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov committed Jan 23, 2025
1 parent 5726d72 commit d22ff3a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
6 changes: 2 additions & 4 deletions net/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type Client struct {
once sync.Once
client http.Client
tr *Transport
log logging.Logger
sr secrets.SecretsReader
}

Expand Down Expand Up @@ -67,9 +66,8 @@ func NewClient(o Options) *Client {
Transport: tr,
CheckRedirect: o.CheckRedirect,
},
tr: tr,
log: o.Log,
sr: sr,
tr: tr,
sr: sr,
}

return c
Expand Down
6 changes: 2 additions & 4 deletions net/redisclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,13 @@ func (j *jumpHash) Get(k string) string {
// Multi-probe consistent hashing - mpchash
// https://arxiv.org/pdf/1505.00062.pdf
type multiprobe struct {
hash *mpchash.Multi
shards []string
hash *mpchash.Multi
}

func NewMultiprobe(shards []string) redis.ConsistentHash {
return &multiprobe{
// 2 seeds and k=21 got from library
hash: mpchash.New(shards, siphash64seed, [2]uint64{1, 2}, 21),
shards: shards,
hash: mpchash.New(shards, siphash64seed, [2]uint64{1, 2}, 21),
}
}

Expand Down
4 changes: 0 additions & 4 deletions ratelimit/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const (
type Registry struct {
sync.Mutex
once sync.Once
closed bool
defaults Settings
global Settings
lookup map[Settings]*Ratelimit
swarm Swarmer
Expand Down Expand Up @@ -52,7 +50,6 @@ func NewSwarmRegistry(swarm Swarmer, ro *net.RedisOptions, settings ...Settings)

r := &Registry{
once: sync.Once{},
defaults: defaults,
global: defaults,
lookup: make(map[Settings]*Ratelimit),
swarm: swarm,
Expand All @@ -72,7 +69,6 @@ func NewSwarmRegistry(swarm Swarmer, ro *net.RedisOptions, settings ...Settings)
// Close teardown Registry and dependent resources
func (r *Registry) Close() {
r.once.Do(func() {
r.closed = true
r.redisRing.Close()
for _, rl := range r.lookup {
rl.Close()
Expand Down
5 changes: 1 addition & 4 deletions routesrv/routesrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
// RouteServer is used to serve eskip-formatted routes,
// that originate from the polled data source.
type RouteServer struct {
metrics metrics.Metrics
server *http.Server
supportServer *http.Server
poller *poller
Expand Down Expand Up @@ -53,9 +52,7 @@ func New(opts skipper.Options) (*RouteServer, error) {
m := metrics.NewMetrics(mopt)
metricsHandler := metrics.NewHandler(mopt, m)

rs := &RouteServer{
metrics: m,
}
rs := &RouteServer{}

opentracingOpts := opts.OpenTracing
if len(opentracingOpts) == 0 {
Expand Down
2 changes: 0 additions & 2 deletions secrets/secrettest/secrettest.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ func (tr *TestRegistry) GetEncrypter(refreshInterval time.Duration, s string) (s
}

type TestingSecretSource struct {
getCount int
secretKey string
}

func (s *TestingSecretSource) GetSecret() ([][]byte, error) {
s.getCount++
return [][]byte{[]byte(s.secretKey)}, nil
}

0 comments on commit d22ff3a

Please sign in to comment.