Skip to content

Commit

Permalink
replaces golint by revive and fix newly reported linter issues (#800)
Browse files Browse the repository at this point in the history
* replaces golint by revive and fix newly reported linter issues

* fix lint issue

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
AndersonQ and MrAlias authored Jun 8, 2021
1 parent 6569d8f commit f2fb9c8
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
enable:
- misspell
- goimports
- golint
- revive
- gofmt

issues:
Expand All @@ -16,12 +16,12 @@ issues:
- path: _test\.go
text: "context.Context should be the first parameter of a function"
linters:
- golint
- revive
# Yes, they are, but it's okay in a test
- path: _test\.go
text: "exported func.*returns unexported type.*which can be annoying to use"
linters:
- golint
- revive

linters-settings:
misspell:
Expand Down
1 change: 1 addition & 0 deletions detectors/aws/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
)

const (
// TypeStr is AWS ECS type.
TypeStr = "ecs"
metadataV3EnvVar = "ECS_CONTAINER_METADATA_URI"
metadataV4EnvVar = "ECS_CONTAINER_METADATA_URI_V4"
Expand Down
2 changes: 1 addition & 1 deletion exporters/metric/cortex/cortex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var validConfig = Config{
}

var testResource = resource.NewWithAttributes(attribute.String("R", "V"))
var mockTime int64 = int64(time.Nanosecond) * time.Time{}.UnixNano() / int64(time.Millisecond)
var mockTime = int64(time.Nanosecond) * time.Time{}.UnixNano() / int64(time.Millisecond)

func TestExportKindFor(t *testing.T) {
exporter := Exporter{}
Expand Down
1 change: 1 addition & 0 deletions exporters/metric/dogstatsd/internal/statsd/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const (
var (
_ export.Exporter = &Exporter{}

//nolint:revive // ignoring missing comments for unexported sentinel errors in an internal package.
ErrInvalidScheme = fmt.Errorf("invalid statsd transport")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

const (
// KafkaTopic name.
KafkaTopic = "sarama-instrumentation-example"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/astaxie/beego"
)

// OTelBeegoHandler implements the http.Handler interface and provides
// Handler implements the http.Handler interface and provides
// trace and metrics to beego web apps.
type Handler struct {
http.Handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package otelaws

import "go.opentelemetry.io/otel/attribute"

// AWS attributes.
const (
OperationKey attribute.Key = "aws.operation"
RegionKey attribute.Key = "aws.region"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package otelmongo

import "go.opentelemetry.io/otel/attribute"

// Mongo DB attributes.
const (
DBApplicationKey = attribute.Key("db.application")
DBNameKey = attribute.Key("db.name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package otelmongo
import "go.opentelemetry.io/otel/attribute"

const (
// PeerHostname records the host name of the peer.
// PeerHostnameKey records the host name of the peer.
PeerHostnameKey = attribute.Key("peer.hostname")
// PeerPort records the port number of the peer.
// PeerPortKey records the port number of the peer.
PeerPortKey = attribute.Key("peer.port")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package otelmongo

import "go.opentelemetry.io/otel/attribute"

// Mongo tag attributes.
const (
TargetHostKey = attribute.Key("out.host")
TargetPortKey = attribute.Key("out.port")
Expand Down
1 change: 1 addition & 0 deletions instrumentation/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (o metricProviderOption) ApplyHost(c *config) {
c.MeterProvider = o.MeterProvider
}

// Attribute sets.
var (
// Attribute sets for CPU time measurements.

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/net/http/httptrace/otelhttptrace/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"net/http/httptrace"
)

// Client
// W3C client.
func W3C(ctx context.Context, req *http.Request) (context.Context, *http.Request) {
ctx = httptrace.WithClientTrace(ctx, NewClientTrace(ctx))
req = req.WithContext(ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"go.opentelemetry.io/otel/trace"
)

// HTTP attributes.
var (
HTTPStatus = attribute.Key("http.status")
HTTPHeaderMIME = attribute.Key("http.mime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func WithPropagators(props propagation.TextMapPropagator) Option {
}
}

// Returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.
// Extract returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.
func Extract(ctx context.Context, req *http.Request, opts ...Option) ([]attribute.KeyValue, []attribute.KeyValue, trace.SpanContext) {
c := newConfig(opts)
ctx = c.propagators.Extract(ctx, propagation.HeaderCarrier(req.Header))
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/labeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (l *Labeler) Add(ls ...attribute.KeyValue) {
l.attributes = append(l.attributes, ls...)
}

// Labels returns a copy of the attributes added to the Labeler.
// Get returns a copy of the attributes added to the Labeler.
func (l *Labeler) Get() []attribute.KeyValue {
l.mu.Lock()
defer l.mu.Unlock()
Expand Down
6 changes: 1 addition & 5 deletions instrumentation/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@ func (r *runtime) register() error {
return err
}

if err := r.registerMemStats(); err != nil {
return err
}

return nil
return r.registerMemStats()
}

func (r *runtime) registerMemStats() error {
Expand Down

0 comments on commit f2fb9c8

Please sign in to comment.