Skip to content

Commit

Permalink
re-enable go vet, and fix warnings. (#703)
Browse files Browse the repository at this point in the history
* re-enable go vet, and fix warnings.

* manually hack versions around.
  • Loading branch information
lizthegrey authored Mar 26, 2020
1 parent 6c32d11 commit 90932e1
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 40 deletions.
4 changes: 2 additions & 2 deletions exporter/opencensusexporter/opencensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (oce *ocAgentExporter) PushTraceData(ctx context.Context, td consumerdata.T
if !ok {
err := &ocExporterError{
code: errAlreadyStopped,
msg: fmt.Sprintf("OpenCensus exporter was already stopped."),
msg: "OpenCensus exporter was already stopped.",
}
return len(td.Spans), err
}
Expand All @@ -179,7 +179,7 @@ func (oce *ocAgentExporter) PushMetricsData(ctx context.Context, md consumerdata
if !ok {
err := &ocExporterError{
code: errAlreadyStopped,
msg: fmt.Sprintf("OpenCensus exporter was already stopped."),
msg: "OpenCensus exporter was already stopped.",
}
return exporterhelper.NumTimeSeries(md), err
}
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlpexporter/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (oce *otlpExporter) pushTraceData(ctx context.Context, td consumerdata.Trac
if !ok {
err := &exporterError{
code: errAlreadyStopped,
msg: fmt.Sprintf("OpenCensus exporter was already stopped."),
msg: "OpenTelemetry exporter was already stopped.",
}
return len(td.Spans), err
}
Expand All @@ -187,7 +187,7 @@ func (oce *otlpExporter) pushMetricsData(ctx context.Context, md consumerdata.Me
if !ok {
err := &exporterError{
code: errAlreadyStopped,
msg: fmt.Sprintf("OpenCensus exporter was already stopped."),
msg: "OpenTelemetry exporter was already stopped.",
}
return exporterhelper.NumTimeSeries(md), err
}
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/gogo/googleapis v1.3.0 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6
github.com/golang/protobuf v1.3.2
github.com/golangci/golangci-lint v1.21.0
github.com/golangci/golangci-lint v1.24.0
github.com/google/addlicense v0.0.0-20200301095109-7c013a14f2e2
github.com/google/go-cmp v0.3.1
github.com/gorilla/handlers v1.4.2 // indirect
Expand All @@ -43,7 +43,7 @@ require (
github.com/soheilhy/cmux v0.1.4
github.com/spf13/cast v1.3.0
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.4.1-0.20190911140308-99520c81d86e
github.com/spf13/viper v1.6.1
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 // indirect
github.com/stretchr/testify v1.4.0
github.com/uber-go/atomic v1.4.0 // indirect
Expand All @@ -57,8 +57,10 @@ require (
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64
google.golang.org/grpc v1.23.0
gopkg.in/yaml.v2 v2.2.8
honnef.co/go/tools v0.0.1-2019.2.3
honnef.co/go/tools v0.0.1-2020.1.3
k8s.io/client-go v12.0.0+incompatible // indirect
)

replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab

replace github.com/spf13/viper => github.com/spf13/viper v1.4.1-0.20190911140308-99520c81d86e
58 changes: 31 additions & 27 deletions go.sum

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions receiver/jaegerreceiver/trace_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
"github.com/jaegertracing/jaeger/thrift-gen/baggage"
"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
jaegerThrift "github.com/jaegertracing/jaeger/thrift-gen/jaeger"
"github.com/jaegertracing/jaeger/thrift-gen/sampling"
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
"github.com/uber/jaeger-lib/metrics"
Expand Down Expand Up @@ -460,7 +459,7 @@ func (jr *jReceiver) startAgent(_ component.Host) error {
}

func (jr *jReceiver) buildProcessor(address string, factory apacheThrift.TProtocolFactory) (processors.Processor, error) {
handler := jaegerThrift.NewAgentProcessor(jr)
handler := jaeger.NewAgentProcessor(jr)
transport, err := thriftudp.NewTUDPServerTransport(address)
if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions receiver/opencensusreceiver/opencensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 t.Skip() flaky test causes unused function warning.

package opencensusreceiver

import (
Expand Down
2 changes: 2 additions & 0 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 t.Skip() flaky test causes unused function warning.

package otlpreceiver

import (
Expand Down
5 changes: 2 additions & 3 deletions translator/internaldata/traces_to_oc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
occommon "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
ocresource "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
octrace "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
v1 "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"

Expand All @@ -31,7 +30,7 @@ import (
)

func TestInternalTraceStateToOC(t *testing.T) {
assert.Equal(t, (*v1.Span_Tracestate)(nil), traceStateToOC(data.TraceState("")))
assert.Equal(t, (*octrace.Span_Tracestate)(nil), traceStateToOC(data.TraceState("")))

ocTracestate := &octrace.Span_Tracestate{
Entries: []*octrace.Span_Tracestate_Entry{
Expand All @@ -52,7 +51,7 @@ func TestInternalTraceStateToOC(t *testing.T) {
}

func TestAttributesMapToOC(t *testing.T) {
assert.EqualValues(t, (*v1.Span_Attributes)(nil), attributesMapToOCSpanAttributes(data.NewAttributeMap(nil), 0))
assert.EqualValues(t, (*octrace.Span_Attributes)(nil), attributesMapToOCSpanAttributes(data.NewAttributeMap(nil), 0))

ocAttrs := &octrace.Span_Attributes{
DroppedAttributesCount: 123,
Expand Down
5 changes: 4 additions & 1 deletion translator/metrics/oc_to_otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,11 @@ func getPointsCount(ocMetric *ocmetrics.Metric) int {
}

func descriptorToOtlp(descriptor *ocmetrics.MetricDescriptor) *otlpmetrics.MetricDescriptor {
if descriptor == nil {
return nil
}
descriptorType := descriptorTypeToOtlp(descriptor.Type)
if descriptor == nil || descriptorType == invalidOtlpMetricDescriptorType {
if descriptorType == invalidOtlpMetricDescriptorType {
return nil
}

Expand Down

0 comments on commit 90932e1

Please sign in to comment.