remove warning from golinter

This commit is contained in:
yabuchan
2022-07-08 10:23:17 +09:00
parent 95bdbdec0d
commit 38e662129d
2 changed files with 9 additions and 13 deletions

View File

@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package openTelemetry implements a github.com/virtual-kubelet/virtual-kubelet/trace.Tracer
// Package opentelemetry implements a github.com/virtual-kubelet/virtual-kubelet/trace.Tracer
// using openTelemetry as a backend.
//
// Use this by setting `trace.T = Adapter{}`
//
// For customizing trace provider used in Adapter, set trace provider by
//`otel.SetTracerProvider(*sdktrace.TracerProvider)`. Examples of customize are setting service name,
// `otel.SetTracerProvider(*sdktrace.TracerProvider)`. Examples of customize are setting service name,
// use your own exporter (e.g. jaeger, otlp, prometheus, zipkin, and stdout) etc. Do not forget
// to call TracerProvider.Shutdown() when you create your TracerProvider to avoid memory leak.
package opentelemetry
@@ -48,10 +48,6 @@ const (
lFatal logLevel = "FATAL"
)
func (l logLevel) string() string {
return string(l)
}
// Adapter implements the trace.Tracer interface for openTelemetry
type Adapter struct{}

View File

@@ -42,7 +42,7 @@ func TestStartSpan(t *testing.T) {
defer cancel()
a := Adapter{}
ctx, s := a.StartSpan(ctx, "name")
_, s := a.StartSpan(ctx, "name")
s.End()
})
}
@@ -182,7 +182,7 @@ func TestWithFields(t *testing.T) {
l := log.G(ctx).WithField("method", tt.spanName)
s := &span{s: ots, l: l}
ctx = s.WithFields(ctx, tt.fields)
_ = s.WithFields(ctx, tt.fields)
s.End()
assert.Assert(t, len(e.attributes) == len(tt.expectedAttributes))
@@ -254,7 +254,7 @@ func TestLog(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
_, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
fl := &fakeLogger{}
l := logger{s: s, l: fl, a: make([]attribute.KeyValue, 0)}
switch tt.logLevel {
@@ -366,7 +366,7 @@ func TestLogf(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
_, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
fl := &fakeLogger{}
l := logger{s: s, l: fl, a: make([]attribute.KeyValue, 0)}
switch tt.logLevel {
@@ -437,7 +437,7 @@ func TestLogWithField(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
_, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
fl := &fakeLogger{}
l := logger{s: s, l: fl, a: make([]attribute.KeyValue, 0)}
@@ -485,7 +485,7 @@ func TestLogWithError(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
_, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
fl := &fakeLogger{}
l := logger{s: s, l: fl, a: make([]attribute.KeyValue, 0)}
@@ -528,7 +528,7 @@ func TestLogWithFields(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
_, s := otel.Tracer(tt.spanName).Start(ctx, tt.spanName)
fl := &fakeLogger{}
l := logger{s: s, l: fl, a: make([]attribute.KeyValue, 0)}