1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:14:42 -07:00

internal/lsp: fix a few small staticcheck warnings

Address unused context / unused error warnings.

Change-Id: Ibd302d58a3d6db5aa274ed95fb6d5a337978779a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/247597
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Danish Dua <danishdua@google.com>
This commit is contained in:
Rebecca Stambler 2020-08-08 11:15:22 -04:00
parent 48de4c84f0
commit fd80f4dbb3
3 changed files with 24 additions and 6 deletions

View File

@ -129,17 +129,23 @@ func (r *runner) CallHierarchy(t *testing.T, spn span.Span, expectedCalls *tests
Range: items[0].Range,
}
if callLocation != loc {
t.Errorf("expected server.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation)
t.Fatalf("expected server.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation)
}
// TODO: add span comparison tests for expectedCalls once call hierarchy is implemented
incomingCalls, err := r.server.IncomingCalls(r.ctx, &protocol.CallHierarchyIncomingCallsParams{Item: items[0]})
if err != nil {
t.Fatal(err)
}
if len(incomingCalls) != 0 {
t.Errorf("expected no incoming calls but got %d", len(incomingCalls))
t.Fatalf("expected no incoming calls but got %d", len(incomingCalls))
}
outgoingCalls, err := r.server.OutgoingCalls(r.ctx, &protocol.CallHierarchyOutgoingCallsParams{Item: items[0]})
if err != nil {
t.Fatal(err)
}
if len(outgoingCalls) != 0 {
t.Errorf("expected no outgoing calls but got %d", len(outgoingCalls))
t.Fatalf("expected no outgoing calls but got %d", len(outgoingCalls))
}
}

View File

@ -56,6 +56,9 @@ func IncomingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pos pr
ctx, done := event.Start(ctx, "source.incomingCalls")
defer done()
// TODO: Remove this once the context is used.
_ = ctx // avoid staticcheck SA4006 warning
return []protocol.CallHierarchyIncomingCall{}, nil
}
@ -64,5 +67,8 @@ func OutgoingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pos pr
ctx, done := event.Start(ctx, "source.outgoingCalls")
defer done()
// TODO: Remove this once the context is used.
_ = ctx // avoid staticcheck SA4006 warning
return []protocol.CallHierarchyOutgoingCall{}, nil
}

View File

@ -123,17 +123,23 @@ func (r *runner) CallHierarchy(t *testing.T, spn span.Span, expectedCalls *tests
Range: items[0].Range,
}
if callLocation != loc {
t.Errorf("expected source.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation)
t.Fatalf("expected source.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation)
}
// TODO: add span comparison tests for expectedCalls once call hierarchy is implemented
incomingCalls, err := source.IncomingCalls(r.ctx, r.snapshot, fh, loc.Range.Start)
if err != nil {
t.Fatal(err)
}
if len(incomingCalls) != 0 {
t.Errorf("expected no incoming calls but got %d", len(incomingCalls))
t.Fatalf("expected no incoming calls but got %d", len(incomingCalls))
}
outgoingCalls, err := source.OutgoingCalls(r.ctx, r.snapshot, fh, loc.Range.Start)
if err != nil {
t.Fatal(err)
}
if len(outgoingCalls) != 0 {
t.Errorf("expected no outgoing calls but got %d", len(outgoingCalls))
t.Fatalf("expected no outgoing calls but got %d", len(outgoingCalls))
}
}