mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +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
|
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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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()))
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user