Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jj22ee committed Nov 6, 2024
1 parent 7cef2d3 commit 18cca02
Show file tree
Hide file tree
Showing 29 changed files with 45 additions and 152 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ linters-settings:
sections:
- standard
- default
- prefix(github.com/open-telemetry/opentelemetry-collector-contrib)

govet:
# settings per analyzer
Expand Down Expand Up @@ -89,9 +88,6 @@ linters-settings:
replacement: any

goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/open-telemetry/opentelemetry-collector-contrib

misspell:
# Correct spellings using locale preferences for US or UK.
Expand Down
6 changes: 2 additions & 4 deletions exporter/awsemfexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ package awsemfexporter // import "github.com/amazon-contributing/opentelemetry-c
import (
"strings"

"go.opentelemetry.io/collector/component"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
"go.opentelemetry.io/collector/component"
"go.uber.org/zap"
)

var (
Expand Down
8 changes: 3 additions & 5 deletions exporter/awsemfexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ import (
"strings"
"testing"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/featuregate"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
)

func TestLoadConfig(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsemfexporter/datapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import (
"strconv"
"time"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"
"golang.org/x/exp/maps"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsemfexporter/datapoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
Expand All @@ -18,8 +19,6 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"go.uber.org/zap/zaptest/observer"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
)

type metricValueType string
Expand Down
7 changes: 3 additions & 4 deletions exporter/awsemfexporter/emf_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
"strings"
"sync"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/appsignals"
"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/google/uuid"
"go.opentelemetry.io/collector/component"
Expand All @@ -19,10 +22,6 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/appsignals"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsemfexporter/emf_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"

"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand All @@ -21,8 +22,6 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"go.uber.org/zap/zaptest/observer"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
)

const defaultRetryCount = 1
Expand Down
8 changes: 3 additions & 5 deletions exporter/awsemfexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ package awsemfexporter // import "github.com/amazon-contributing/opentelemetry-c
import (
"context"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/featuregate"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
)

var defaultNoRollupfg = featuregate.GlobalRegistry().MustRegister("awsemf.nodimrollupdefault", featuregate.StageAlpha,
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsemfexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import (
"path/filepath"
"testing"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/exporter/exportertest"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter/internal/metadata"
)

func TestCreateDefaultConfig(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsemfexporter/grouped_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"encoding/json"
"strings"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"

aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
)

// groupedMetric defines set of metrics with same namespace, timestamp and labels
Expand Down
5 changes: 2 additions & 3 deletions exporter/awsemfexporter/metric_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import (
"strings"
"time"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/multierr"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
aws "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics"
)

const (
Expand Down
7 changes: 3 additions & 4 deletions exporter/awsemfexporter/metric_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"testing"
"time"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
Expand All @@ -20,8 +21,6 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"go.uber.org/zap/zaptest/observer"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs"
)

// Copied from "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal/occonventions"
Expand Down Expand Up @@ -132,7 +131,7 @@ func stringSlicesEqual(expected, actual []string) bool {
return true
}

func min(i, j int) int {
func customMin(i, j int) int {
if i < j {
return i
}
Expand All @@ -153,7 +152,7 @@ func (d dimensionality) Less(i, j int) bool {
dim1 := d[i]
dim2 := d[j]

for k := 0; k < min(len(dim1), len(dim2)); k++ {
for k := 0; k < customMin(len(dim1), len(dim2)); k++ {
if dim1[k] != dim2[k] {
return dim1[k] < dim2[k]
}
Expand Down
9 changes: 4 additions & 5 deletions exporter/awsxrayexporter/awsxray.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import (
"errors"
"fmt"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/translator"
"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/xray"
"go.opentelemetry.io/collector/component"
Expand All @@ -19,11 +23,6 @@ import (
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/translator"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
)

const (
Expand Down
7 changes: 3 additions & 4 deletions exporter/awsxrayexporter/awsxray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"time"

"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry/telemetrytest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
Expand All @@ -24,10 +27,6 @@ import (
"go.opentelemetry.io/collector/pdata/ptrace"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry/telemetrytest"
)

func TestTraceExport(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsxrayexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
package awsxrayexporter // import "github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter"

import (
"go.opentelemetry.io/collector/component"

"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
"go.opentelemetry.io/collector/component"
)

// Config defines configuration for AWS X-Ray exporter.
Expand Down
5 changes: 2 additions & 3 deletions exporter/awsxrayexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import (
"path/filepath"
"testing"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
)

func TestLoadConfig(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions exporter/awsxrayexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ package awsxrayexporter // import "github.com/amazon-contributing/opentelemetry-
import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/featuregate"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/featuregate"
)

var skipTimestampValidationFeatureGate = featuregate.GlobalRegistry().MustRegister(
Expand Down
5 changes: 2 additions & 3 deletions exporter/awsxrayexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ import (
"path/filepath"
"testing"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/exporter/exportertest"
"go.opentelemetry.io/collector/featuregate"

"github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil"
)

func TestCreateDefaultConfig(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsxrayexporter/internal/translator/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import (
"strconv"
"strings"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/aws/aws-sdk-go/aws"
"go.opentelemetry.io/collector/pdata/pcommon"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
)

func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, logGroupNames []string) (map[string]pcommon.Value, *awsxray.AWSData) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsxrayexporter/internal/translator/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ package translator
import (
"testing"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/aws/aws-sdk-go/aws"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/pdata/pcommon"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
)

func TestAwsFromEc2Resource(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsxrayexporter/internal/translator/cause.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import (
"strconv"
"strings"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/aws/aws-sdk-go/aws"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
)

// ExceptionEventName the name of the exception event.
Expand Down
3 changes: 1 addition & 2 deletions exporter/awsxrayexporter/internal/translator/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"net"
"strconv"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
"github.com/aws/aws-sdk-go/aws"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"

awsxray "github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray"
)

const (
Expand Down
Loading

0 comments on commit 18cca02

Please sign in to comment.