-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: doesn't work well when jumping to definitions through the module cache #32209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've attempted to create a minimal reproduce case for this, and I cannot. This works fine: package main
import (
"log"
"google.golang.org/grpc"
)
func main() {
_, err := grpc.Dial(":8080", grpc.WithInsecure())
if err != nil {
log.Println(err)
}
} Within VSCode, I can navigate by clicking through Dial and am able to jump to other functions/etc from there. However, I have a much larger project - effectively a Go monorepo - and within that, the same code navigation does not work. Clicking dial brings me to GRPC, but I can't then navigate to anything else. I've had coworkers report that I am not really sure how to gather debug output/diagnostics, or what I would need to do to assemble a reproduce case for this given that a super minimal case doesn't result in any issues. If you've got suggestions, I am happy to follow them, however. |
You can share your VSCode |
Thanks for that information! I was able to capture some logs:
It starts off like this: [bhatfield go-services]% head /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/clientconn.go
/*
*
* Copyright 2014 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* |
Happy to gather further information as needed. |
Also, confirmed that both my minimal repro attempt (which works fine) and the larger monorepo (which does not) both use the same grpc and have the same sum:
|
can you try also if you do If you don't have that binary you can get it with |
(edit: I initially ran |
Just did a little spelunking with |
@bmhatfield: What do you mean by that? Is there a bug in the |
I'm not sure - I tried to do a little spelunking to see if I could provide some additional context, but I got a bit turned around with |
@bmhatfield Run the following: gopackage's mode flag accepts the following values: files, imports, types, syntax, allsyntax |
Thanks for the tip! Running this gets me type information as you indicated. However first run is very slow (I assume compiling). Go package "google.golang.org/grpc":
package grpc
has complete exported type info
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/backoff.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/balancer.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/balancer_conn_wrappers.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/balancer_v1_wrapper.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/call.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/clientconn.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/codec.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/dialoptions.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/doc.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/interceptor.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/picker_wrapper.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/pickfirst.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/preloader.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/proxy.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/resolver_conn_wrapper.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/rpc_util.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/server.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/service_config.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/stream.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/trace.go
file /Users/bhatfield/go/pkg/mod/google.golang.org/grpc@v1.21.0/version.go
import "bufio"
import "bytes"
import "compress/gzip"
import "context"
import "encoding/base64"
import "encoding/binary"
import "encoding/json"
import "errors"
import "fmt"
import "golang.org/x/net/trace"
import "google.golang.org/grpc/balancer"
import "google.golang.org/grpc/balancer/roundrobin"
import "google.golang.org/grpc/codes"
import "google.golang.org/grpc/connectivity"
import "google.golang.org/grpc/credentials"
import "google.golang.org/grpc/encoding"
import "google.golang.org/grpc/encoding/proto"
import "google.golang.org/grpc/grpclog"
import "google.golang.org/grpc/internal"
import "google.golang.org/grpc/internal/backoff"
import "google.golang.org/grpc/internal/balancerload"
import "google.golang.org/grpc/internal/binarylog"
import "google.golang.org/grpc/internal/channelz"
import "google.golang.org/grpc/internal/envconfig"
import "google.golang.org/grpc/internal/grpcrand"
import "google.golang.org/grpc/internal/grpcsync"
import "google.golang.org/grpc/internal/transport"
import "google.golang.org/grpc/keepalive"
import "google.golang.org/grpc/metadata"
import "google.golang.org/grpc/naming"
import "google.golang.org/grpc/peer"
import "google.golang.org/grpc/resolver"
import "google.golang.org/grpc/resolver/dns"
import "google.golang.org/grpc/resolver/passthrough"
import "google.golang.org/grpc/stats"
import "google.golang.org/grpc/status"
import "google.golang.org/grpc/tap"
import "io"
import "io/ioutil"
import "math"
import "net"
import "net/http"
import "net/http/httputil"
import "net/url"
import "reflect"
import "runtime"
import "strconv"
import "strings"
import "sync"
import "sync/atomic"
import "time"
type Address struct{Addr string; Metadata interface{}}
type BackoffConfig struct{MaxDelay time.Duration}
type Balancer interface{Close() error; Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error); Notify() <-chan []Address; Start(target string, config BalancerConfig) error; Up(addr Address) (down func(error))}
method (Balancer) Close() error
method (Balancer) Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error)
method (Balancer) Notify() <-chan []Address
method (Balancer) Start(target string, config BalancerConfig) error
method (Balancer) Up(addr Address) (down func(error))
type BalancerConfig struct{DialCreds google.golang.org/grpc/credentials.TransportCredentials; Dialer func(context.Context, string) (net.Conn, error)}
type BalancerGetOptions struct{BlockingWait bool}
func CallContentSubtype(contentSubtype string) CallOption
func CallCustomCodec(codec Codec) CallOption
type CallOption interface{after(*callInfo); before(*callInfo) error}
type ClientConn struct{ctx context.Context; cancel context.CancelFunc; target string; parsedTarget google.golang.org/grpc/resolver.Target; authority string; dopts dialOptions; csMgr *connectivityStateManager; balancerBuildOpts google.golang.org/grpc/balancer.BuildOptions; blockingpicker *pickerWrapper; mu sync.RWMutex; resolverWrapper *ccResolverWrapper; sc *ServiceConfig; conns map[*addrConn]struct{}; mkp google.golang.org/grpc/keepalive.ClientParameters; curBalancerName string; balancerWrapper *ccBalancerWrapper; retryThrottler sync/atomic.Value; firstResolveEvent *google.golang.org/grpc/internal/grpcsync.Event; channelzID int64; czData *channelzData}
method (*ClientConn) Close() error
method (*ClientConn) GetMethodConfig(method string) MethodConfig
method (*ClientConn) GetState() google.golang.org/grpc/connectivity.State
method (*ClientConn) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error
method (*ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error)
method (*ClientConn) ResetConnectBackoff()
method (*ClientConn) Target() string
method (*ClientConn) WaitForStateChange(ctx context.Context, sourceState google.golang.org/grpc/connectivity.State) bool
type ClientStream interface{CloseSend() error; Context() context.Context; Header() (google.golang.org/grpc/metadata.MD, error); RecvMsg(m interface{}) error; SendMsg(m interface{}) error; Trailer() google.golang.org/grpc/metadata.MD}
method (ClientStream) CloseSend() error
method (ClientStream) Context() context.Context
method (ClientStream) Header() (google.golang.org/grpc/metadata.MD, error)
method (ClientStream) RecvMsg(m interface{}) error
method (ClientStream) SendMsg(m interface{}) error
method (ClientStream) Trailer() google.golang.org/grpc/metadata.MD
func Code(err error) google.golang.org/grpc/codes.Code
type Codec interface{Marshal(v interface{}) ([]byte, error); String() string; Unmarshal(data []byte, v interface{}) error}
method (Codec) Marshal(v interface{}) ([]byte, error)
method (Codec) String() string
method (Codec) Unmarshal(data []byte, v interface{}) error
type Compressor interface{Do(w io.Writer, p []byte) error; Type() string}
method (Compressor) Do(w io.Writer, p []byte) error
method (Compressor) Type() string
type CompressorCallOption struct{CompressorType string}
func ConnectionTimeout(d time.Duration) ServerOption
type ContentSubtypeCallOption struct{ContentSubtype string}
func Creds(c google.golang.org/grpc/credentials.TransportCredentials) ServerOption
func CustomCodec(codec Codec) ServerOption
type CustomCodecCallOption struct{Codec Codec}
type Decompressor interface{Do(r io.Reader) ([]byte, error); Type() string}
method (Decompressor) Do(r io.Reader) ([]byte, error)
method (Decompressor) Type() string
var DefaultBackoffConfig BackoffConfig
func Dial(target string, opts ...DialOption) (*ClientConn, error)
func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error)
type DialOption interface{apply(*dialOptions)}
type EmptyCallOption struct{}
type EmptyDialOption struct{}
type EmptyServerOption struct{}
var EnableTracing bool
var ErrClientConnClosing error
var ErrClientConnTimeout error
var ErrServerStopped error
func ErrorDesc(err error) string
func Errorf(c google.golang.org/grpc/codes.Code, format string, a ...interface{}) error
func FailFast(failFast bool) CallOption
type FailFastCallOption struct{FailFast bool}
func FailOnNonTempDialError(f bool) DialOption
func ForceCodec(codec google.golang.org/grpc/encoding.Codec) CallOption
type ForceCodecCallOption struct{Codec google.golang.org/grpc/encoding.Codec}
func Header(md *google.golang.org/grpc/metadata.MD) CallOption
type HeaderCallOption struct{HeaderAddr *google.golang.org/grpc/metadata.MD}
func InTapHandle(h google.golang.org/grpc/tap.ServerInHandle) ServerOption
func InitialConnWindowSize(s int32) ServerOption
func InitialWindowSize(s int32) ServerOption
func Invoke(ctx context.Context, method string, args interface{}, reply interface{}, cc *ClientConn, opts ...CallOption) error
func KeepaliveEnforcementPolicy(kep google.golang.org/grpc/keepalive.EnforcementPolicy) ServerOption
func KeepaliveParams(kp google.golang.org/grpc/keepalive.ServerParameters) ServerOption
func MaxCallRecvMsgSize(s int) CallOption
func MaxCallSendMsgSize(s int) CallOption
func MaxConcurrentStreams(n uint32) ServerOption
func MaxHeaderListSize(s uint32) ServerOption
func MaxMsgSize(m int) ServerOption
func MaxRecvMsgSize(m int) ServerOption
type MaxRecvMsgSizeCallOption struct{MaxRecvMsgSize int}
func MaxRetryRPCBufferSize(bytes int) CallOption
type MaxRetryRPCBufferSizeCallOption struct{MaxRetryRPCBufferSize int}
func MaxSendMsgSize(m int) ServerOption
type MaxSendMsgSizeCallOption struct{MaxSendMsgSize int}
func Method(ctx context.Context) (string, bool)
type MethodConfig struct{WaitForReady *bool; Timeout *time.Duration; MaxReqSize *int; MaxRespSize *int; retryPolicy *retryPolicy}
type MethodDesc struct{MethodName string; Handler methodHandler}
func MethodFromServerStream(stream ServerStream) (string, bool)
type MethodInfo struct{Name string; IsClientStream bool; IsServerStream bool}
func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error)
func NewContextWithServerTransportStream(ctx context.Context, stream ServerTransportStream) context.Context
func NewGZIPCompressor() Compressor
func NewGZIPCompressorWithLevel(level int) (Compressor, error)
func NewGZIPDecompressor() Decompressor
func NewServer(opt ...ServerOption) *Server
func Peer(p *google.golang.org/grpc/peer.Peer) CallOption
type PeerCallOption struct{PeerAddr *google.golang.org/grpc/peer.Peer}
func PerRPCCredentials(creds google.golang.org/grpc/credentials.PerRPCCredentials) CallOption
type PerRPCCredsCallOption struct{Creds google.golang.org/grpc/credentials.PerRPCCredentials}
const PickFirstBalancerName untyped string
type PreparedMsg struct{encodedData []byte; hdr []byte; payload []byte}
method (*PreparedMsg) Encode(s Stream, msg interface{}) error
func RPCCompressor(cp Compressor) ServerOption
func RPCDecompressor(dc Decompressor) ServerOption
func ReadBufferSize(s int) ServerOption
func RoundRobin(r google.golang.org/grpc/naming.Resolver) Balancer
func SendHeader(ctx context.Context, md google.golang.org/grpc/metadata.MD) error
type Server struct{opts serverOptions; mu sync.Mutex; lis map[net.Listener]bool; conns map[io.Closer]bool; serve bool; drain bool; cv *sync.Cond; m map[string]*service; events golang.org/x/net/trace.EventLog; quit chan struct{}; done chan struct{}; quitOnce sync.Once; doneOnce sync.Once; channelzRemoveOnce sync.Once; serveWG sync.WaitGroup; channelzID int64; czData *channelzData}
method (*Server) GetServiceInfo() map[string]ServiceInfo
method (*Server) GracefulStop()
method (*Server) RegisterService(sd *ServiceDesc, ss interface{})
method (*Server) Serve(lis net.Listener) error
method (*Server) ServeHTTP(w net/http.ResponseWriter, r *net/http.Request)
method (*Server) Stop()
type ServerOption interface{apply(*serverOptions)}
type ServerStream interface{Context() context.Context; RecvMsg(m interface{}) error; SendHeader(google.golang.org/grpc/metadata.MD) error; SendMsg(m interface{}) error; SetHeader(google.golang.org/grpc/metadata.MD) error; SetTrailer(google.golang.org/grpc/metadata.MD)}
method (ServerStream) Context() context.Context
method (ServerStream) RecvMsg(m interface{}) error
method (ServerStream) SendHeader(google.golang.org/grpc/metadata.MD) error
method (ServerStream) SendMsg(m interface{}) error
method (ServerStream) SetHeader(google.golang.org/grpc/metadata.MD) error
method (ServerStream) SetTrailer(google.golang.org/grpc/metadata.MD)
type ServerTransportStream interface{Method() string; SendHeader(md google.golang.org/grpc/metadata.MD) error; SetHeader(md google.golang.org/grpc/metadata.MD) error; SetTrailer(md google.golang.org/grpc/metadata.MD) error}
method (ServerTransportStream) Method() string
method (ServerTransportStream) SendHeader(md google.golang.org/grpc/metadata.MD) error
method (ServerTransportStream) SetHeader(md google.golang.org/grpc/metadata.MD) error
method (ServerTransportStream) SetTrailer(md google.golang.org/grpc/metadata.MD) error
func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream
type ServiceConfig struct{LB *string; Methods map[string]MethodConfig; retryThrottling *retryThrottlingPolicy; healthCheckConfig *healthCheckConfig; rawJSONString string}
type ServiceDesc struct{ServiceName string; HandlerType interface{}; Methods []MethodDesc; Streams []StreamDesc; Metadata interface{}}
type ServiceInfo struct{Methods []MethodInfo; Metadata interface{}}
func SetHeader(ctx context.Context, md google.golang.org/grpc/metadata.MD) error
func SetTrailer(ctx context.Context, md google.golang.org/grpc/metadata.MD) error
func StatsHandler(h google.golang.org/grpc/stats.Handler) ServerOption
type Stream interface{Context() context.Context; RecvMsg(m interface{}) error; SendMsg(m interface{}) error}
method (Stream) Context() context.Context
method (Stream) RecvMsg(m interface{}) error
method (Stream) SendMsg(m interface{}) error
type StreamClientInterceptor func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error)
type StreamDesc struct{StreamName string; Handler StreamHandler; ServerStreams bool; ClientStreams bool}
type StreamHandler func(srv interface{}, stream ServerStream) error
func StreamInterceptor(i StreamServerInterceptor) ServerOption
type StreamServerInfo struct{FullMethod string; IsClientStream bool; IsServerStream bool}
type StreamServerInterceptor func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error
type Streamer func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error)
const SupportPackageIsVersion3 untyped bool
const SupportPackageIsVersion4 untyped bool
const SupportPackageIsVersion5 untyped bool
func Trailer(md *google.golang.org/grpc/metadata.MD) CallOption
type TrailerCallOption struct{TrailerAddr *google.golang.org/grpc/metadata.MD}
type UnaryClientInterceptor func(ctx context.Context, method string, req interface{}, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error
type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error)
func UnaryInterceptor(i UnaryServerInterceptor) ServerOption
type UnaryInvoker func(ctx context.Context, method string, req interface{}, reply interface{}, cc *ClientConn, opts ...CallOption) error
type UnaryServerInfo struct{Server interface{}; FullMethod string}
type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error)
func UnknownServiceHandler(streamHandler StreamHandler) ServerOption
func UseCompressor(name string) CallOption
const Version untyped string
func WaitForReady(waitForReady bool) CallOption
func WithAuthority(a string) DialOption
func WithBackoffConfig(b BackoffConfig) DialOption
func WithBackoffMaxDelay(md time.Duration) DialOption
func WithBalancer(b Balancer) DialOption
func WithBalancerName(balancerName string) DialOption
func WithBlock() DialOption
func WithChainStreamInterceptor(interceptors ...StreamClientInterceptor) DialOption
func WithChainUnaryInterceptor(interceptors ...UnaryClientInterceptor) DialOption
func WithChannelzParentID(id int64) DialOption
func WithCodec(c Codec) DialOption
func WithCompressor(cp Compressor) DialOption
func WithContextDialer(f func(context.Context, string) (net.Conn, error)) DialOption
func WithCredentialsBundle(b google.golang.org/grpc/credentials.Bundle) DialOption
func WithDecompressor(dc Decompressor) DialOption
func WithDefaultCallOptions(cos ...CallOption) DialOption
func WithDefaultServiceConfig(s string) DialOption
func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption
func WithDisableHealthCheck() DialOption
func WithDisableRetry() DialOption
func WithDisableServiceConfig() DialOption
func WithInitialConnWindowSize(s int32) DialOption
func WithInitialWindowSize(s int32) DialOption
func WithInsecure() DialOption
func WithKeepaliveParams(kp google.golang.org/grpc/keepalive.ClientParameters) DialOption
func WithMaxHeaderListSize(s uint32) DialOption
func WithMaxMsgSize(s int) DialOption
func WithPerRPCCredentials(creds google.golang.org/grpc/credentials.PerRPCCredentials) DialOption
func WithReadBufferSize(s int) DialOption
func WithServiceConfig(c <-chan ServiceConfig) DialOption
func WithStatsHandler(h google.golang.org/grpc/stats.Handler) DialOption
func WithStreamInterceptor(f StreamClientInterceptor) DialOption
func WithTimeout(d time.Duration) DialOption
func WithTransportCredentials(creds google.golang.org/grpc/credentials.TransportCredentials) DialOption
func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption
func WithUserAgent(s string) DialOption
func WithWaitForHandshake() DialOption
func WithWriteBufferSize(s int) DialOption
func WriteBufferSize(s int) ServerOption |
What else can I do to help gather information here? |
@julieqiu who could perform the investigation as per the NeedsInvestigation label? If this can help, as vscode user I see the same problem. |
@marco-m Would you be able to supply the logs and other diagnostic information suggested in the troubleshooting section here: |
@thepudds I wanted to provide the diagnostics, but now I cannot reproduce the problem any more 🤔so I am happy and confused :-) |
@bmhatfield: Are you still seeing this issue with the latest version of |
It seems that the issue still exists in the latest code? |
@cocodee: Can you provide logs like the ones above for the case you are seeing? |
@stamblerre it appears that this issue is improved! But unfortunately not fully resolved. Jumping through |
Do the red underlines also appear when you do jump to definition from the minimal case? (the one from earlier that did work for you). Do you see any new error messages in the |
Going to close this issue since it's been about a month since the last discussion. Please open a new issue if this problem persists. |
Forked from upstream: microsoft/vscode-go#2533.
The text was updated successfully, but these errors were encountered: