diff --git a/internal/lsp/link.go b/internal/lsp/link.go index 86c59fc4dc..2f9f006664 100644 --- a/internal/lsp/link.go +++ b/internal/lsp/link.go @@ -137,7 +137,7 @@ func goLinks(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle if view.IsGoPrivatePath(target) { continue } - if mod, version, ok := moduleAtVersion(ctx, snapshot, target, pkg); ok && strings.ToLower(view.Options().LinkTarget) == "pkg.go.dev" { + if mod, version, ok := moduleAtVersion(target, pkg); ok && strings.ToLower(view.Options().LinkTarget) == "pkg.go.dev" { target = strings.Replace(target, mod, mod+"@"+version, 1) } // Account for the quotation marks in the positions. @@ -170,7 +170,7 @@ func goLinks(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle return links, nil } -func moduleAtVersion(ctx context.Context, snapshot source.Snapshot, target string, pkg source.Package) (string, string, bool) { +func moduleAtVersion(target string, pkg source.Package) (string, string, bool) { impPkg, err := pkg.GetImport(target) if err != nil { return "", "", false