Skip to content

Commit

Permalink
order import mods to follow good practice
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Panato <[email protected]>
  • Loading branch information
cpanato authored and poiana committed Mar 8, 2021
1 parent 41cc715 commit c3962df
Show file tree
Hide file tree
Showing 29 changed files with 60 additions and 43 deletions.
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"strings"
"text/template"

"github.com/falcosecurity/falcosidekick/types"

"github.com/spf13/viper"
kingpin "gopkg.in/alecthomas/kingpin.v2"

"github.com/falcosecurity/falcosidekick/types"
)

func getConfig() *types.Configuration {
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"strings"

"github.com/DataDog/datadog-go/statsd"
"github.com/falcosecurity/falcosidekick/outputs"
"github.com/falcosecurity/falcosidekick/types"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/falcosecurity/falcosidekick/outputs"
"github.com/falcosecurity/falcosidekick/types"
)

// Globale variables
Expand Down
3 changes: 2 additions & 1 deletion outputs/alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"strings"
"testing"

"github.com/falcosecurity/falcosidekick/types"
"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewAlertmanagerPayloadO(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions outputs/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"os"
"time"

"github.com/falcosecurity/falcosidekick/types"

"github.com/DataDog/datadog-go/statsd"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
Expand All @@ -23,6 +21,8 @@ import (
"github.com/aws/aws-sdk-go/service/sns"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/aws/aws-sdk-go/service/sts"

"github.com/falcosecurity/falcosidekick/types"
)

// NewAWSClient returns a new output.Client for accessing the AWS API.
Expand Down
1 change: 1 addition & 0 deletions outputs/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

eventhub "github.com/Azure/azure-event-hubs-go/v3"
"github.com/DataDog/datadog-go/statsd"

"github.com/falcosecurity/falcosidekick/types"
)

Expand Down
4 changes: 2 additions & 2 deletions outputs/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"net/url"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

var falcoTestInput = `{"output":"This is a test from falcosidekick","priority":"Debug","rule":"Test rule", "time":"2001-01-01T01:10:00Z","output_fields": {"proc.name":"falcosidekick", "proc.tty": 1234}}`
Expand Down
3 changes: 2 additions & 1 deletion outputs/cloudevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package outputs

import (
"context"
cloudevents "github.com/cloudevents/sdk-go/v2"
"log"

cloudevents "github.com/cloudevents/sdk-go/v2"

"github.com/falcosecurity/falcosidekick/types"
)

Expand Down
3 changes: 2 additions & 1 deletion outputs/datadog.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package outputs

import (
"github.com/falcosecurity/falcosidekick/types"
"log"

"github.com/falcosecurity/falcosidekick/types"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions outputs/datadog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewDatadogPayload(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion outputs/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package outputs

import (
"fmt"
"github.com/falcosecurity/falcosidekick/types"
"log"

"github.com/falcosecurity/falcosidekick/types"
)

type discordPayload struct {
Expand Down
3 changes: 2 additions & 1 deletion outputs/discord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"fmt"
"testing"

"github.com/falcosecurity/falcosidekick/types"
"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewDiscordPayload(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion outputs/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (

"cloud.google.com/go/pubsub"
"github.com/DataDog/datadog-go/statsd"
"github.com/falcosecurity/falcosidekick/types"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"

"github.com/falcosecurity/falcosidekick/types"
)

// NewGCPClient returns a new output.Client for accessing the GCP API.
Expand Down
4 changes: 2 additions & 2 deletions outputs/googlechat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"text/template"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewGoogleChatPayload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions outputs/influxdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewInfluxdbPayload(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion outputs/kubeless.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"strconv"

"github.com/DataDog/datadog-go/statsd"
"github.com/falcosecurity/falcosidekick/types"
"github.com/google/uuid"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"

"github.com/falcosecurity/falcosidekick/types"
)

// NewKubelessClient returns a new output.Client for accessing Kubernetes.
Expand Down
4 changes: 2 additions & 2 deletions outputs/loki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewLokiPayload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions outputs/mattermost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"text/template"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestMattermostPayload(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion outputs/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"regexp"
"strings"

"github.com/falcosecurity/falcosidekick/types"
nats "github.com/nats-io/nats.go"

"github.com/falcosecurity/falcosidekick/types"
)

var slugRegularExpression = regexp.MustCompile("[^a-z0-9]+")
Expand Down
3 changes: 2 additions & 1 deletion outputs/opsgenie.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package outputs

import (
"github.com/falcosecurity/falcosidekick/types"
"log"

"github.com/falcosecurity/falcosidekick/types"
)

type opsgeniePayload struct {
Expand Down
4 changes: 2 additions & 2 deletions outputs/opsgenie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewOpsgeniePayload(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions outputs/pagerduty.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/PagerDuty/go-pagerduty"

"github.com/falcosecurity/falcosidekick/types"
)

Expand Down
6 changes: 4 additions & 2 deletions outputs/pagerduty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package outputs

import (
"encoding/json"
"testing"

"github.com/PagerDuty/go-pagerduty"
"github.com/falcosecurity/falcosidekick/types"
"github.com/stretchr/testify/require"
"testing"

"github.com/falcosecurity/falcosidekick/types"
)

func TestPagerdutyPayload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions outputs/rocketchat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"text/template"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewRocketchatPayload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions outputs/slack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"text/template"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewSlackPayload(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion outputs/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"strings"
textTemplate "text/template"

"github.com/DataDog/datadog-go/statsd"
sasl "github.com/emersion/go-sasl"
smtp "github.com/emersion/go-smtp"

"github.com/DataDog/datadog-go/statsd"
"github.com/falcosecurity/falcosidekick/types"
)

Expand Down
3 changes: 2 additions & 1 deletion outputs/stan.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"log"
"strings"

"github.com/falcosecurity/falcosidekick/types"
stan "github.com/nats-io/stan.go"

"github.com/falcosecurity/falcosidekick/types"
)

// StanPublish publishes event to NATS Streaming
Expand Down
7 changes: 4 additions & 3 deletions outputs/statsd.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package outputs

import (
"github.com/DataDog/datadog-go/statsd"
"github.com/falcosecurity/falcosidekick/types"

"log"
"strings"

"github.com/DataDog/datadog-go/statsd"

"github.com/falcosecurity/falcosidekick/types"
)

// NewStatsdClient returns a new output.Client for sending metrics to StatsD.
Expand Down
4 changes: 2 additions & 2 deletions outputs/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/falcosecurity/falcosidekick/types"

"github.com/stretchr/testify/require"

"github.com/falcosecurity/falcosidekick/types"
)

func TestNewTeamsPayload(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion stats_prometheus.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"github.com/falcosecurity/falcosidekick/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/falcosecurity/falcosidekick/types"
)

func getInitPromStats() *types.PromStatistics {
Expand Down

0 comments on commit c3962df

Please sign in to comment.