mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
chore: remove unused parameters
They were not detected by revive in function literals.
This commit is contained in:
@@ -22,7 +22,7 @@ var conntrackFixerCmd = &cobra.Command{
|
||||
Long: `This helper cleans the conntrack entries for the UDP ports exposed by
|
||||
containers started with the label "akvorado.conntrack.fix=1".`,
|
||||
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.
|
||||
r, err := reporter.New(reporter.DefaultConfiguration())
|
||||
if err != nil {
|
||||
|
||||
@@ -17,7 +17,7 @@ var healthcheckCmd = &cobra.Command{
|
||||
Use: "healthcheck",
|
||||
Short: "Check healthness",
|
||||
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")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -19,7 +19,7 @@ var debug bool
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "akvorado",
|
||||
Short: "Flow collector, enricher and visualizer",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
PersistentPreRun: func(_ *cobra.Command, _ []string) {
|
||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,7 @@ var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version",
|
||||
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(" Built with: %s\n", runtime.Version())
|
||||
cmd.Println()
|
||||
|
||||
@@ -41,7 +41,7 @@ func TestProtectedDecodeHook(t *testing.T) {
|
||||
A 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 {
|
||||
panic(errors.New("noooo"))
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestRemoteDataSourceFetcher(t *testing.T) {
|
||||
// Mux to answer requests
|
||||
ready := make(chan bool)
|
||||
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 {
|
||||
case <-ready:
|
||||
default:
|
||||
|
||||
@@ -130,7 +130,7 @@ func TestRoot(t *testing.T) {
|
||||
})
|
||||
|
||||
// New container
|
||||
t.Run("new container", func(t *testing.T) {
|
||||
t.Run("new container", func(_ *testing.T) {
|
||||
dockerClientMock.EXPECT().
|
||||
ContainerList(gomock.Any(), gomock.Any()).
|
||||
Return([]types.Container{{ID: "new one"}}, nil)
|
||||
|
||||
@@ -18,7 +18,7 @@ type oobMessage struct {
|
||||
|
||||
// listenConfig configures a listening socket to reuse port and return overflows
|
||||
var listenConfig = net.ListenConfig{
|
||||
Control: func(network, address string, c syscall.RawConn) error {
|
||||
Control: func(_, _ string, c syscall.RawConn) error {
|
||||
var err error
|
||||
c.Control(func(fd uintptr) {
|
||||
opts := udpSocketOptions
|
||||
|
||||
@@ -110,7 +110,7 @@ func New(r *reporter.Reporter, configuration Configuration, dependencies Depende
|
||||
c.d.Daemon.Track(&c.t, "inlet/flow")
|
||||
|
||||
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.Write([]byte(c.d.Schema.ProtobufDefinition()))
|
||||
}))
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestInitStaticExporters(t *testing.T) {
|
||||
p := &Provider{
|
||||
r: r,
|
||||
exportersMap: map[string][]exporterInfo{},
|
||||
put: func(update provider.Update) {},
|
||||
put: func(_ provider.Update) {},
|
||||
}
|
||||
p.exporters.Store(conf.Exporters)
|
||||
|
||||
@@ -73,7 +73,7 @@ func TestRemoteExporterSources(t *testing.T) {
|
||||
// Mux to answer requests
|
||||
ready := make(chan bool)
|
||||
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 {
|
||||
case <-ready:
|
||||
default:
|
||||
|
||||
@@ -200,7 +200,7 @@ func (r *rib) flushPeerContext(ctx context.Context, peer uint32, steps int) (int
|
||||
iter := r.tree.Iterate()
|
||||
runtime.Gosched()
|
||||
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 {
|
||||
r.nlris.Take(payload.nlri)
|
||||
r.nextHops.Take(payload.nextHop)
|
||||
|
||||
@@ -81,7 +81,7 @@ func (c *Component) addHandlerEmbedded(url string, path string) {
|
||||
func (c *Component) registerHTTPHandlers() error {
|
||||
// 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
|
||||
if err := initShTemplate.Execute(&result, initShVariables{
|
||||
FlowSchemaHash: c.d.Schema.ProtobufMessageHash(),
|
||||
@@ -109,7 +109,7 @@ func (c *Component) registerHTTPHandlers() error {
|
||||
for name, dict := range c.d.Schema.GetCustomDictConfig() {
|
||||
name := name
|
||||
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)
|
||||
if err != nil {
|
||||
c.r.Err(err).Msg("unable to deliver custom dict csv file")
|
||||
@@ -123,7 +123,7 @@ func (c *Component) registerHTTPHandlers() error {
|
||||
|
||||
// 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 {
|
||||
case <-c.networkSourcesFetcher.DataSourcesReady:
|
||||
case <-time.After(c.config.NetworkSourcesTimeout):
|
||||
@@ -155,7 +155,7 @@ func (c *Component) registerHTTPHandlers() error {
|
||||
// asns.csv (when there are some custom-defined ASNs)
|
||||
if len(c.config.ASNs) != 0 {
|
||||
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")
|
||||
if err != nil {
|
||||
c.r.Err(err).Msg("unable to open data/asns.csv")
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestNetworkSources(t *testing.T) {
|
||||
// Mux to answer requests
|
||||
ready := make(chan bool)
|
||||
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 {
|
||||
case <-ready:
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user