chore: remove unused parameters

They were not detected by revive in function literals.
This commit is contained in:
Vincent Bernat
2024-02-08 08:30:23 +01:00
parent 4fbfda2501
commit b3a9f6ab2e
13 changed files with 17 additions and 17 deletions

View File

@@ -22,7 +22,7 @@ var conntrackFixerCmd = &cobra.Command{
Long: `This helper cleans the conntrack entries for the UDP ports exposed by Long: `This helper cleans the conntrack entries for the UDP ports exposed by
containers started with the label "akvorado.conntrack.fix=1".`, containers started with the label "akvorado.conntrack.fix=1".`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
// This is a simplified service which is not configurable. // This is a simplified service which is not configurable.
r, err := reporter.New(reporter.DefaultConfiguration()) r, err := reporter.New(reporter.DefaultConfiguration())
if err != nil { if err != nil {

View File

@@ -17,7 +17,7 @@ var healthcheckCmd = &cobra.Command{
Use: "healthcheck", Use: "healthcheck",
Short: "Check healthness", Short: "Check healthness",
Long: `Check if Akvorado is alive using the builtin HTTP endpoint.`, Long: `Check if Akvorado is alive using the builtin HTTP endpoint.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
resp, err := http.Get("http://localhost:8080/api/v0/healthcheck") resp, err := http.Get("http://localhost:8080/api/v0/healthcheck")
if err != nil { if err != nil {
return err return err

View File

@@ -19,7 +19,7 @@ var debug bool
var RootCmd = &cobra.Command{ var RootCmd = &cobra.Command{
Use: "akvorado", Use: "akvorado",
Short: "Flow collector, enricher and visualizer", Short: "Flow collector, enricher and visualizer",
PersistentPreRun: func(cmd *cobra.Command, args []string) { PersistentPreRun: func(_ *cobra.Command, _ []string) {
if isatty.IsTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
} else { } else {

View File

@@ -30,7 +30,7 @@ var versionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "Print version", Short: "Print version",
Long: `Display version and build information about akvorado.`, Long: `Display version and build information about akvorado.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
cmd.Printf("akvorado %s\n", Version) cmd.Printf("akvorado %s\n", Version)
cmd.Printf(" Built with: %s\n", runtime.Version()) cmd.Printf(" Built with: %s\n", runtime.Version())
cmd.Println() cmd.Println()

View File

@@ -41,7 +41,7 @@ func TestProtectedDecodeHook(t *testing.T) {
A string A string
B string B string
} }
panicHook := func(from, to reflect.Type, data interface{}) (interface{}, error) { panicHook := func(from, _ reflect.Type, data interface{}) (interface{}, error) {
if from.Kind() == reflect.String { if from.Kind() == reflect.String {
panic(errors.New("noooo")) panic(errors.New("noooo"))
} }

View File

@@ -42,7 +42,7 @@ func TestRemoteDataSourceFetcher(t *testing.T) {
// Mux to answer requests // Mux to answer requests
ready := make(chan bool) ready := make(chan bool)
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/data.json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mux.Handle("/data.json", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
select { select {
case <-ready: case <-ready:
default: default:

View File

@@ -130,7 +130,7 @@ func TestRoot(t *testing.T) {
}) })
// New container // New container
t.Run("new container", func(t *testing.T) { t.Run("new container", func(_ *testing.T) {
dockerClientMock.EXPECT(). dockerClientMock.EXPECT().
ContainerList(gomock.Any(), gomock.Any()). ContainerList(gomock.Any(), gomock.Any()).
Return([]types.Container{{ID: "new one"}}, nil) Return([]types.Container{{ID: "new one"}}, nil)

View File

@@ -18,7 +18,7 @@ type oobMessage struct {
// listenConfig configures a listening socket to reuse port and return overflows // listenConfig configures a listening socket to reuse port and return overflows
var listenConfig = net.ListenConfig{ var listenConfig = net.ListenConfig{
Control: func(network, address string, c syscall.RawConn) error { Control: func(_, _ string, c syscall.RawConn) error {
var err error var err error
c.Control(func(fd uintptr) { c.Control(func(fd uintptr) {
opts := udpSocketOptions opts := udpSocketOptions

View File

@@ -110,7 +110,7 @@ func New(r *reporter.Reporter, configuration Configuration, dependencies Depende
c.d.Daemon.Track(&c.t, "inlet/flow") c.d.Daemon.Track(&c.t, "inlet/flow")
c.d.HTTP.AddHandler("/api/v0/inlet/flow/schema.proto", c.d.HTTP.AddHandler("/api/v0/inlet/flow/schema.proto",
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.Write([]byte(c.d.Schema.ProtobufDefinition())) w.Write([]byte(c.d.Schema.ProtobufDefinition()))
})) }))

View File

@@ -38,7 +38,7 @@ func TestInitStaticExporters(t *testing.T) {
p := &Provider{ p := &Provider{
r: r, r: r,
exportersMap: map[string][]exporterInfo{}, exportersMap: map[string][]exporterInfo{},
put: func(update provider.Update) {}, put: func(_ provider.Update) {},
} }
p.exporters.Store(conf.Exporters) p.exporters.Store(conf.Exporters)
@@ -73,7 +73,7 @@ func TestRemoteExporterSources(t *testing.T) {
// Mux to answer requests // Mux to answer requests
ready := make(chan bool) ready := make(chan bool)
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/exporters.json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mux.Handle("/exporters.json", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
select { select {
case <-ready: case <-ready:
default: default:

View File

@@ -200,7 +200,7 @@ func (r *rib) flushPeerContext(ctx context.Context, peer uint32, steps int) (int
iter := r.tree.Iterate() iter := r.tree.Iterate()
runtime.Gosched() runtime.Gosched()
for iter.Next() { for iter.Next() {
removed += iter.DeleteWithBuffer(buf, func(payload route, val route) bool { removed += iter.DeleteWithBuffer(buf, func(payload route, _ route) bool {
if payload.peer == peer { if payload.peer == peer {
r.nlris.Take(payload.nlri) r.nlris.Take(payload.nlri)
r.nextHops.Take(payload.nextHop) r.nextHops.Take(payload.nextHop)

View File

@@ -81,7 +81,7 @@ func (c *Component) addHandlerEmbedded(url string, path string) {
func (c *Component) registerHTTPHandlers() error { func (c *Component) registerHTTPHandlers() error {
// init.sh // init.sh
c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/init.sh", c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/init.sh",
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
var result bytes.Buffer var result bytes.Buffer
if err := initShTemplate.Execute(&result, initShVariables{ if err := initShTemplate.Execute(&result, initShVariables{
FlowSchemaHash: c.d.Schema.ProtobufMessageHash(), FlowSchemaHash: c.d.Schema.ProtobufMessageHash(),
@@ -109,7 +109,7 @@ func (c *Component) registerHTTPHandlers() error {
for name, dict := range c.d.Schema.GetCustomDictConfig() { for name, dict := range c.d.Schema.GetCustomDictConfig() {
name := name name := name
dict := dict dict := dict
c.d.HTTP.AddHandler(fmt.Sprintf("/api/v0/orchestrator/clickhouse/custom_dict_%s.csv", name), http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { c.d.HTTP.AddHandler(fmt.Sprintf("/api/v0/orchestrator/clickhouse/custom_dict_%s.csv", name), http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
file, err := os.ReadFile(dict.Source) file, err := os.ReadFile(dict.Source)
if err != nil { if err != nil {
c.r.Err(err).Msg("unable to deliver custom dict csv file") c.r.Err(err).Msg("unable to deliver custom dict csv file")
@@ -123,7 +123,7 @@ func (c *Component) registerHTTPHandlers() error {
// networks.csv // networks.csv
c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/networks.csv", c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/networks.csv",
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
select { select {
case <-c.networkSourcesFetcher.DataSourcesReady: case <-c.networkSourcesFetcher.DataSourcesReady:
case <-time.After(c.config.NetworkSourcesTimeout): case <-time.After(c.config.NetworkSourcesTimeout):
@@ -155,7 +155,7 @@ func (c *Component) registerHTTPHandlers() error {
// asns.csv (when there are some custom-defined ASNs) // asns.csv (when there are some custom-defined ASNs)
if len(c.config.ASNs) != 0 { if len(c.config.ASNs) != 0 {
c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/asns.csv", c.d.HTTP.AddHandler("/api/v0/orchestrator/clickhouse/asns.csv",
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
f, err := data.Open("data/asns.csv") f, err := data.Open("data/asns.csv")
if err != nil { if err != nil {
c.r.Err(err).Msg("unable to open data/asns.csv") c.r.Err(err).Msg("unable to open data/asns.csv")

View File

@@ -24,7 +24,7 @@ func TestNetworkSources(t *testing.T) {
// Mux to answer requests // Mux to answer requests
ready := make(chan bool) ready := make(chan bool)
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/amazon.json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mux.Handle("/amazon.json", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
select { select {
case <-ready: case <-ready:
default: default: