Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
golangci enable gci (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
wph95 authored Mar 31, 2021
1 parent 8f9be2c commit 0356f77
Show file tree
Hide file tree
Showing 67 changed files with 163 additions and 96 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ linters:
- errcheck
enable:
- gofmt
- gci
- bodyclose
- goconst
- gocritic
Expand Down
3 changes: 2 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package agent
import (
"sync"

"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/database"
"github.com/open-telemetry/opentelemetry-log-collection/pipeline"
"go.uber.org/zap"
)

// LogAgent is an entity that handles log monitoring.
Expand Down
3 changes: 2 additions & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"fmt"
"testing"

"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/testutil"
)

func TestStartAgentSuccess(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions agent/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import (
"fmt"
"time"

"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/open-telemetry/opentelemetry-log-collection/database"
"github.com/open-telemetry/opentelemetry-log-collection/errors"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/plugin"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)

// LogAgentBuilder is a construct used to build a log agent
Expand Down
3 changes: 2 additions & 1 deletion agent/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import (
"path/filepath"
"testing"

"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/testutil"
)

func TestBuildAgentSuccess(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (
"io/ioutil"
"path/filepath"

"github.com/open-telemetry/opentelemetry-log-collection/pipeline"
yaml "gopkg.in/yaml.v2"

"github.com/open-telemetry/opentelemetry-log-collection/pipeline"
)

// Config is the configuration of the stanza log agent.
Expand Down
3 changes: 2 additions & 1 deletion agent/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
_ "github.com/open-telemetry/opentelemetry-log-collection/operator/builtin/transformer/noop"
"github.com/open-telemetry/opentelemetry-log-collection/pipeline"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

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

import (
"github.com/open-telemetry/opentelemetry-log-collection/entry"
"go.uber.org/zap/zapcore"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
)

// parseEntry will create a stanza entry from a zapcore entry.
Expand Down
3 changes: 2 additions & 1 deletion operator/build_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"fmt"
"strings"

"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/database"
"github.com/open-telemetry/opentelemetry-log-collection/logger"
"go.uber.org/zap"
)

// BuildContext supplies contextual resources when building an operator.
Expand Down
7 changes: 4 additions & 3 deletions operator/builtin/input/file/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import (
"strings"
"time"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"golang.org/x/text/encoding"
"golang.org/x/text/encoding/ianaindex"
"golang.org/x/text/encoding/unicode"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

func init() {
Expand Down
5 changes: 3 additions & 2 deletions operator/builtin/input/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import (
"sync"
"time"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"go.uber.org/zap"
"golang.org/x/text/encoding"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

// InputOperator is an operator that monitors files for entries
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import (
"time"

"github.com/observiq/nanojack"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func newDefaultConfig(tempDir string) *InputConfig {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/file/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
"os"
"path/filepath"

"github.com/open-telemetry/opentelemetry-log-collection/errors"
"go.uber.org/zap"
"golang.org/x/text/encoding"
"golang.org/x/text/transform"

"github.com/open-telemetry/opentelemetry-log-collection/errors"
)

// Reader manages a single file
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/generate/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package generate
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func TestInputGenerate(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/journald/journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import (
"time"

jsoniter "github.com/json-iterator/go"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"go.uber.org/zap"
)

func init() {
Expand Down
9 changes: 5 additions & 4 deletions operator/builtin/input/k8sevent/k8s_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ import (
"sync"
"time"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/errors"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/rest"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/errors"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

func init() {
Expand Down
7 changes: 4 additions & 3 deletions operator/builtin/input/k8sevent/k8s_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import (
"testing"
"time"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -30,6 +27,10 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
fakev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
fakeTest "k8s.io/client-go/testing"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
)

var fakeTime = time.Date(2000, 1, 1, 1, 1, 1, 1, time.UTC)
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/stanza/stanza_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func TestStanzaOperator(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions operator/builtin/input/stdin/stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
package stdin

import (
"bufio"
"context"
"fmt"
"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"os"
"sync"

"bufio"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

func init() {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/stdin/stdin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func TestStdin(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"net"
"sync"

"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"go.uber.org/zap"
)

func init() {
Expand Down
5 changes: 3 additions & 2 deletions operator/builtin/input/udp/udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import (
"testing"
"time"

"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

func udpInputTest(input []byte, expected []string) func(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/input/windows/xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
"testing"
"time"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
)

func TestParseValidTimestamp(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/output/drop/drop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func TestBuildValid(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion operator/builtin/output/stdout/stdout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
"github.com/stretchr/testify/require"
)

func TestStdoutOperator(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions operator/builtin/parser/json/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (
"path"
"testing"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

type testCase struct {
Expand Down
1 change: 1 addition & 0 deletions operator/builtin/parser/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"

jsoniter "github.com/json-iterator/go"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
Expand Down
5 changes: 3 additions & 2 deletions operator/builtin/parser/regex/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (
"path"
"testing"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
)

type testCase struct {
Expand Down
1 change: 1 addition & 0 deletions operator/builtin/parser/syslog/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
sl "github.com/observiq/go-syslog/v3"
"github.com/observiq/go-syslog/v3/rfc3164"
"github.com/observiq/go-syslog/v3/rfc5424"

"github.com/open-telemetry/opentelemetry-log-collection/entry"
"github.com/open-telemetry/opentelemetry-log-collection/operator"
"github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
Expand Down
Loading

0 comments on commit 0356f77

Please sign in to comment.