Skip to content

Commit

Permalink
enable errcheck and exclude all components which are not passing. (#9726
Browse files Browse the repository at this point in the history
)

* add errcheck to golangci-lint config, and exclude all components which are not passing.

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* fix missing issues for linux

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* fix missing issues for linux

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
  • Loading branch information
fatsheep9146 authored May 5, 2022
1 parent 1fbbcd1 commit 2e78267
Show file tree
Hide file tree
Showing 158 changed files with 160 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ linters-settings:
- kilometres

linters:
disable:
- errcheck
enable:
- exportloopref
- gofmt
Expand All @@ -107,6 +105,7 @@ linters:
- staticcheck
- unconvert
- unparam
- errcheck

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
Expand Down
1 change: 1 addition & 0 deletions examples/demo/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

// Sample contains a simple http server that exports to the OpenTelemetry agent.
// nolint:errcheck
package main

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awscloudwatchlogsexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awscloudwatchlogsexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awscloudwatchlogsexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awscloudwatchlogsexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsemfexporter/emf_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awsemfexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsemfexporter/grouped_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awsemfexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsemfexporter/metric_declaration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awsemfexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsemfexporter/metric_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awsemfexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsxrayexporter/awsxray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package awsxrayexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/awsxrayexporter/internal/translator/cause.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package translator // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/translator"

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package translator

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/carbonexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package carbonexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/coralogixexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package coralogixexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/coralogixexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package datadogexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/internal/metrics/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package metrics

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package translator

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/internal/testutils/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package testutils // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutils"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package datadogexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/traces_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package datadogexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/dynatraceexporter/metrics_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package dynatraceexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/elasticexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package elasticexporter

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

// Package elastic contains an OTLP exporter for Elastic APM.
// nolint:errcheck
package elastic // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticexporter/internal/translator/elastic"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/elasticsearchexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Package elasticsearchexporter contains an opentelemetry-collector exporter
// for Elasticsearch.
// nolint:errcheck
package elasticsearchexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/elasticsearchexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package elasticsearchexporter

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// Ingest Node is used. But either way, we try to present only well formed
// document to Elasticsearch.

// nolint:errcheck
package objmodel // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter/internal/objmodel"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/googlecloudexporter/legacymetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Package googlecloudexporter contains the wrapper for OpenTelemetry-GoogleCloud
// exporter to be used in opentelemetry-collector.
// nolint:errcheck
package googlecloudexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlecloudexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/googlecloudexporter/legacymetrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package googlecloudexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/honeycombexporter/honeycomb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package honeycombexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/honeycombexporter/honeycomb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package honeycombexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/humioexporter/humio_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package humioexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/humioexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/jaegerthrifthttpexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package jaegerthrifthttpexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerthrifthttpexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/log_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/resolver_dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/resolver_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/resolver_static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/loadbalancingexporter/trace_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package loadbalancingexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/newrelicexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package newrelicexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/newrelicexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/newrelicexporter/newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package newrelicexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/newrelicexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/prometheusexporter/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package prometheusexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/prometheusremotewriteexporter/wal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package prometheusremotewriteexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/sentryexporter/sentry_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package sentryexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/dpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package signalfxexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/eventclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package signalfxexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter"

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package signalfxexporter

import (
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck
package signalfxexporter

import (
Expand Down
Loading

0 comments on commit 2e78267

Please sign in to comment.